Quantcast
Channel: VBForums - ASP, VB Script
Viewing all 687 articles
Browse latest View live

Script to get version of a file in a folder that changes its name

$
0
0
Hooroo all,

First time here so please be patient with me.

What I want to do is get the file version of a file in a folder where the folder name has a potentially different name. Exact info now so it all makes sense.

I need to get the version of the Java.dll file in c:\program files (x86)\Java\jre<version_installed> so I can see if it is below the latest version, and if true uninstall the old version and install the new version.

The issue is that the folder name will change depending on the version of Java installed - eg c:\program files (x86)\Java\jre1.x.x.x_xx so using the good old objFSO.FileExists or objFSO.FolderExists is not going to work as you cannot use wildcards with these commands for the folder path (eg If objFSO.FolderExists("C:\Program Files (x86)\Java\jre* or %") = True Then

So thats my problem. I have tried to use the Registry to assist but this causes a similiar issue where the reg settings are based on the version of Java installed - so it makes it hard to determine a numerical value to compare the installed version to what I want to install as the latest version.

So if anyone knows some nice tricks to achieve my goal that would be fantastic :)

Cheers - Paul

Convert RTF ot PDF using pdfcreator

$
0
0
Trying to modify sample vbs script from pdf creator to convert an rtf file to a pdf.

I am having an issue with the shell execute.

Can someone please give me the right syntax.

' PDFCreator COM Interface test for VBScript
' Part of the PDFCreator application
' License: GPL
' Homepage: http://www.pdfforge.org/pdfcreator
' Version: 1.0.0.0
' Created: June, 16. 2015
' Modified: June, 16. 2015
' Author: Sazan Hoti
' Comments: This project demonstrates the use of the COM Interface of PDFCreator.
' This script has been modified to convert rtf to pdf.
' Note: More usage examples then in the VBScript directory can be found in the JavaScript directory only.

Dim ShellObj, PDFCreatorQueue, scriptName, fullPath, printJob, objFSO, tmp

if (WScript.Version < 5.6) then
MsgBox "You need the Windows Scripting Host version 5.6 or greater!"
WScript.Quit
end if

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set ShellObj = CreateObject("Shell.Application")
Set PDFCreatorQueue = CreateObject("PDFCreator.JobQueue")
fullPath = objFSO.GetParentFolderName(WScript.ScriptFullname ) & "\\report.pdf "

MsgBox "Initializing PDFCreator queue..."
PDFCreatorQueue.Initialize

MsgBox "Set default printer to pdf creator and print .rtf"


ShellObj.ShellExecute "print","c:\report.rtf","", "open",1


MsgBox "Waiting for the job to arrive at the queue for 10 seconds..."
if not PDFCreatorQueue.WaitForJob(10) then
MsgBox "The print job did not reach the queue within " & " 10 seconds"
else
MsgBox "Currently there are " & PDFCreatorQueue.Count & " job(s) in the queue"

! MsgBox "Merging all available jobs now"
! PDFCreatorQueue.MergeAllJobs

! MsgBox "Now there are " & PDFCreatorQueue.Count & " job(s) in the queue"
! MsgBox "Getting job instance"
Set printJob = PDFCreatorQueue.NextJob

printJob.SetProfileByGuid("DefaultGuid")


MsgBox "Converting under ""DefaultGuid"" conversion profile but with .Tif as output format"
printJob.ConvertTo(fullPath)

if (not printJob.IsFinished or not printJob.IsSuccessful) then
MsgBox "Could not convert the file: " & fullPath
else
MsgBox "Job finished successfully"
end if
end if

MsgBox "Releasing the object"
PDFCreatorQueue.ReleaseCom

DB Script ADO Connection *.dbf file

$
0
0
http://www.codeproject.com/Articles/...on-Strings#OLE DB SqlServer

talk about connection strings or scripts, one script makes a tcp/ip Localhost to ADO connection
I do not get what type of script or how to use the script.

some software uses *.dbf files to make a ADO connection that I would like to make

I have MySQL Server 5.7 that is at the moment With a schema called foo.co.nz containing a table named 'users' that I will add more tables too, that I want a ADO Connection to.

How do I make a this foo.dbf file to do this and how do I install it like Delphi does with their demos.

I found
http://phplens.com/lens/adodb/tute.htm but I do not know how to run it ether

[RESOLVED] VBScript & Microsoft Forms 2.0 & Opus

$
0
0
Hi,

I'm currently working on a project to create a program that runs inside Opus (by Bruker).
Opus has a basic form designer (circa VB6 era by the look of it) with any code you write done in VB6:

Code:

dateExperimentStart = Now
 TimerRunScript.enabled = True
 Form.ShowControl("btnStopTempScript")
 Form.HideControl("listTemperatureScript")
 Form.HideControl("txtSelectedScan")
 Form.HideControl("txtSelectedTemperature")
 Form.HideControl("txtSelectedHoldTemperature")
 Form.HideControl("btnUpdateTemperatureScript")
 Form.ShowControl("listTemperatureScript")
 listTemperatureScript.Locked = True
 listTemperatureScript.MousePointer = 12

So you can use some properties that we all recognise like locked and mousepointer, but there are restrictions like not using the visible property and instead having to use HideControl and ShowControl.

There is some documentation, but I'm struggling what to Google for as I've never seen VBScript used with forms and there are rarely any posts relating to this. I try VB6 syntax and this sometimes works. The code editor is as functional as Notepad, so no Intellisense, debugger or anything really.

Has anyone come across another product that uses the combination of VBScript and MS Forms that has decent documentation?

Thanks

Kristian

VB File to change file files with extension .rmt and and donot strart with era*

$
0
0
Hello, I need help with writing a script to run in c:\Test folder to look for files with extension ".rmt". If the file name does not start with "era*" I want to rename the file so that it starts with "era" Plus original file name. If it is not possible to have the original file name then I want to have the name "era" followed by the sequential number 1, 2, 3 etc.
Can someone help me out?
Thanks in advance.

[RESOLVED] Permission Denied on new Object

$
0
0
Hello,

I have copied the sample of a Class from the VBScript language reference:

Code:

Class Customer
    Private m_CustomerName

    ' CustomerName property.
    Public Property Get CustomerName
        CustomerName = m_CustomerName
    End Property

    Public Property Let CustomerName(custname)
        m_CustomerName = custname
    End Property
End Class

and a function to create a new Instance of Customer:


Code:

        Public Function doit ()
                        On Error Resume Next
                        Dim a
                        Set a = New Customer
                        If err.number <> 0 Then
                                %>Err: <%= err.Description & " " & err.Number %><%
                        End If
                        Set doit = a
        End Function

When I call the function with

Code:

Dim x
Set x = doit()

I see an Error: 70, Permission Denied.

I do not have any clue, why I receive a filesystem error here on a simple New statement.
Do you have an idea?

Thank you
mmu1


The problem has been solved using Arrays instead of a List of Classes

Converting File

$
0
0
Hi Team,

Please anyone can help me with below issue ?

I was having .vb file script in the folder. I have copied .vb file on desktop and try to open . I had tried to open with Notepad so , all .vb file converted into Notepad file but extension remain the .vb file format.

Can anyone tell me how to change to original format :(

Passing an array from VBScript to COM enabled VB.NET Library...

$
0
0
Hi,

Getting this error below:

Error:0 'Invalid procedure call or argument: 'objFit.Simple''

VBScript Code:

Code:

dim objFit , alInputTemperatures
set objFit = CreateObject("VB_EPICS.CurveFunctions")
alInputTemperatures = Array(10,20,30,50)
msgbox(objFit.Simple(alInputTemperatures))


VB.NET Library Code:

Code:

Public Class CurveFunctions
    Public Function Simple(ByRef inp() As Single) As String
        Return "Hello There"
    End Function


I can call the function fine if I change its input parameter to say just a single and call it passing in just a single.

I've read that it could be that when VB Script is passing in the array, it is actually a variant and so doesn't match what the function is expecting, hence the error.

Here's a link to someone else who had the problem, but no solution:

http://www.visualbasicscript.com/m34060-print.aspx


All this is on Windows 7. VBScript is running via OPUS software made by Bruker. VB.NET library created in VS2010

Thanks

Resolving a argument when passing the string to another program?

$
0
0
Hi all,

I am executing a Python script via a VBscript and I wish to pass it the input & output file locations.

The script works when I have the input filename / path hardcoded, but the input file will be defined earlier on in the script.

Working code:

Code:

Set WSHShell = CreateObject("Wscript.Shell")
Return = WSHShell.Run("E:\Git\bin\bash.exe --login -i -c MORE /P "". F:/Users/py27/scripts/activate; tessewrapper -i F:/Input_File_Path/_File_Name.csv -o F:/Output_File_Path""" , 0, True)

I have: strPathAndFile = F:\Input_File_Path\_File_Name.csv (windows location)

So basically I need strPathAndFile in my code to replace the input file?

Can anyone help?

"checking a textbox is numerical before converting it" - How to do this succinctly?

$
0
0
Hi,

My Environment is Windows 7, 3rd party VBScript Engine and MS Forms.

I'm doing "isnumeric" checks on a load of values in textboxes and listviews before doing a "CInt" on each of them.

What's the most compact way of doing this.
I started off like this:

Code:

            if IsNumeric(txtPositionsTakenAtTemperature.Text) then
                singPositionsTakenAtTemperature = CSng(txtPositionsTakenAtTemperature.Text)
            else
                msgbox("'Sample Positions taken at' is blank or is not a number")
                exit sub
            end if


and moved onto this until I realised it would display an error, but then move on the next textbox:

Code:

subAddNumberToLV alCalibrationTemperatures, txtCalibrateTempStart
subAddNumberToLV alCalibrationX, txtCalibrateX
subAddNumberToLV alCalibrationY, txtCalibrateY

Code:

sub subAddNumberToLV( ByRef lvListView, ByRef strItem)

    if IsNumeric(strItem) then
        lvListView.Add(CSng(strItem))
    else
        msgbox(strItem & " is not a number")
        exit sub
    end if

End Sub

I could set an error flag in the sub and check it after every time I call subAddNumberToLV, but then it makes the code very bulky.
I don't have a controls container which I could loop through.
I did raise an error in the sub, but that stopped the code completely and closed the form which means the user would need to type everything in again.

Any thoughts?

Thanks

Kristian

VBS script to parse a directory of .csv files

$
0
0
I have many directories of weather data containing lots of .csv files (hundreds of thousands) I developed a script that went through and changed a character in each filename of a particular type so that I could isolate particular files easier. Now I need to look in those files and pull out ONE field of data, I am looking for either the highest or lowest temperature on a given date.
Typical data in the files looks like this

#2015-01-31 03:00:04#,19.49

I need to concentrate on the 19.49 field. Only 2 fields in these particular files.

Thanks to all

vb.net 2010 cant display asp page

$
0
0
I am a complete novice so please avoid jargon if you can. :) I want to understand how to create a aspx page called from a simple Html page

Using vb 2010 I created a web page with works locally and I can press buttons and up pops messages

Code:

Public Class Site
    Inherits System.Web.UI.MasterPage

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        MsgBox("Hi Kinga....this is Button1 one method (Routine)")
    End Sub

    Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        MsgBox("Hi Kinga....this is Button2 one method (Routine)")
    End Sub

    Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        MsgBox("Hi Kinga....this is Button3 one method (Routine)")
    End Sub
End Class

It works locally but when running in brower i get this


Server Error in '/' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Source Error:


An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Source File: \\web-123win\winpackage22\dokcon.com\www.dokcon.com\web\content\kingagirl\web.config Line: 18


Show Additional Configuration Errors:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34280

Originally the error was something about custom error which I turned to OFF

web.config is as follows. The default of vb is to include a link to SQL which I do not want anyway


HTML Code:

<configuration>
  <connectionStrings>
    <add name="ApplicationServices"
        connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
        providerName="System.Data.SqlClient" />

  </connectionStrings>

  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />

    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
    </authentication>

   
        <customErrors mode="Off" defaultRedirect="kingaGirl.htm"/>
   
    <membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
            enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
            maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
            applicationName="/" />

      </providers>
    </membership>

    <profile>
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
      </providers>
    </profile>

    <roleManager enabled="false">
      <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
      </providers>
    </roleManager>

  </system.web>

I'd be very grateful if you can help

Richard

vbs - xls to csv

$
0
0
Hi, not sure if I'm in the right place here. I'm trying to take a directory of xls files and have them converted to csv into a different directory. I've got this, but I don't know how to change the saving directory.

WorkingDir = "C:\EXCEL\Test"
Extension = ".XLS"

Dim fso, myFolder, fileColl, aFile, FileName, SaveName
Dim objExcel,objWorkbook

Set fso = CreateObject("Scripting.FilesystemObject")
Set myFolder = fso.GetFolder(WorkingDir)
Set fileColl = myFolder.Files

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = False
objExcel.DisplayAlerts= False

For Each aFile In fileColl
ext = Right(aFile.Name,4)
If UCase(ext) = UCase(extension) Then
'open excel
FileName = Left(aFile,InStrRev(aFile,"."))
Set objWorkbook = objExcel.Workbooks.Open(aFile)
SaveName = FileName & "csv"
objWorkbook.SaveAs SaveName, 23
objWorkbook.Close
End If
Next

Set objWorkbook = Nothing
Set objExcel = Nothing
Set fso = Nothing
Set myFolder = Nothing
Set fileColl = Nothing

Thanks in advance.

Parsing SOAP XML with Classic ASP

$
0
0
I'm typically a LAMP stack developer, so I'm a little out of my comfort zone on this one. I'm working on a classic ASP site that is doing a SOAP based XML API connection. It's worked in the past, but now we're updating the API to connect to a different application. I set up a SOAP client before writing this API, and it tested good. I've run several tests since to be sure that it is still working.

I set up a local ASP server to try to get the most detailed error possible. Here's what I get:
Code:

Microsoft VBScript runtime error '800a01a8'

Object required: '[object]'

/inc/verify.asp, line 66

Line 66 is as follows:
Code:

isSuccess = objDoc.getElementsByTagName("Status").item(0).text
If it is helpful, here is the full document.

Code:

<%@ language=vbscript %>
<% Option Explicit %>
<%
'============================================================'
'  Authenticate a representative using the representative's
'  user name (RepDID or EmailAddress) and password.
'============================================================'

'----------------------------------------------------------'
' Process User Submitted Data
'----------------------------------------------------------'
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then

        'Load form fields into variables
        Response.Write "<p>Loading form fields into variables</p>"
        Dim repUsername, repPassword
        repUsername = Trim(Request.Form("rep-username"))
        repPassword = Trim(Request.Form("rep-password"))

        'Set up basic Validation...
        Response.Write "<p>Validating form</p>"
        If repUsername = "" Or repPassword = "" Then
                Response.Redirect ("../index.asp?login=error#login")

        Else
                '----------------------------------------------------------'
                ' Compose SOAP Request
                '----------------------------------------------------------'
                Dim xobj, SOAPRequest
                Set xobj = Server.CreateObject("Msxml2.ServerXMLHTTP")
                xobj.Open "POST", "http://api.domain.com/3.0/Api.asmx", False
                xobj.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
                xobj.setRequestHeader "SOAPAction", "http://api.domain.com/AuthenticateCustomer"
                SOAPRequest = _
                "<?xml version=""1.0"" encoding=""utf-8""?>" &_
                        "<x:Envelope xmlns:x='http://schemas.xmlsoap.org/soap/envelope/' xmlns:api='http://api.domain.com/'>"&_
                                "<x:Header>" &_
                                        "<api:ApiAuthentication>" &_
                                                "<api:LoginName>string</api:LoginName>" &_
                                                "<api:Password>string</api:Password>" &_
                                                "<api:Company>string</api:Company>" &_
                                        "<api:ApiAuthentication>" &_
                                "</x:Header>" &_
                                "<x:Body>" &_
                                        "<api:AuthenticateCustomerRequest>" &_
                                                "<api:LoginName>"&repUsername&"</api:LoginName>" &_
                                                "<api:Password>"&repPassword&"</api:Password>" &_
                                        "</api:AuthenticateCustomerRequest>" &_
                                "</x:Body>" &_
                        "</x:Envelope>"

                Response.Write "<p>Sending SOAP envelope</p>"
                xobj.send SOAPRequest

        '----------------------------------------------------------'
        ' Retrieve SOAP Response
        '----------------------------------------------------------'
                Dim strReturn, objDoc, isSuccess
                Response.Write "<p>Receiving SOAP response</p>"
                strReturn = xobj.responseText 'Get the return envelope

        Set objDoc = CreateObject("Microsoft.XMLDOM")
                objDoc.async = False
                Response.Write "<p>Loading XML</p>"
                objDoc.LoadXml(strReturn)
                Response.Write "<p>Parsing XML</p>"
                isSuccess = objDoc.getElementsByTagName("Status").item(0).text

                '----------------------------------------------------------'
                ' If user is valid set Session Authenticated otherwise
                ' restrict user and redirect to the index page and show error
                '----------------------------------------------------------'
                Response.Write "<p>Authenticating...</p>"
                If isSuccess = "Success" Then
                        Session("Authenticated") = 1
                        'Session.Timeout = 1 '60 'Expire session 1 hours from current time
                        Response.Redirect ("../welcome.asp#AdvancedTrainingVideos")

                Else
                        Session("Authenticated") = 0
                        Response.Redirect ("../index.asp?login=error#login")

                End IF 'END - isSuccess

        End IF ' END - Basic Validation...
End IF 'END - REQUEST_METHOD POST

%>

Any insights are very welcome.

No JSON Arrays Left to Parse

$
0
0
I am working to get my code to loop through arrays of JSON strings (of same format) until it reaches the end of the arrays (i.e., no strings left). I need the code to recognize it has reached the end by identifying that a certain identifier (present in every set) does not have additional information in the next array. So I believe I am looking for "while" syntax that says "while this identifier has content" proceed parsing the JSON according to the below code. My existing code works for array of strings for which I know the length - unfortunately the lengths are variable therefore I need flexible syntax to adjust with the lengths (i.e., "For 0 to n" doesn't work every time).

The JSON code I am parsing is in this format:

Code:

{"id":1,"prices":[{"name":"expressTaxi","cost":{"base":"USD4.50"....}}
Here the identifier structure I'd like to augment with some type of while loop (the "i" is the index number depending on the # of loop in the yet to be implemented "while" loop).

Code:

Json("prices")(i)("name")
So ideally looking for something like:

Code:

"While Json("prices")(i)("name") has information" then proceed on....
Please note again, everything works when I know the length -- just looking for a small syntax update, thank you! Full code below:

Code:

Option Explicit

Sub getJSON()
sheetCount = 1
i = 1
urlArray = Array("URL1", “URL2”, “URL3”)

Dim MyRequest As Object: Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
Dim MyUrls: MyUrls = urlArray
Dim k As Long
Dim Json As Object

For k = LBound(MyUrls) To UBound(MyUrls)
    With MyRequest
        .Open "GET", MyUrls(k)
        .Send
        Set Json = JsonConverter.ParseJson(.ResponseText)
      ''[where I’d like some type of While statement checking into the below line for content]
        Sheets("Sheet" & sheetCount).Cells(i, 1) = Json("prices")(i)("name")
        Sheets("Sheet" & sheetCount).Cells(i, 2) = Json("prices")(i)("cost")("base")
        i = i + 1
  End With
sheetCount = sheetCount + 1
Next
End Sub


How to search for more than 1 value using RegExp

$
0
0
I have a working VB scripts that currently search a single value under the session variable property_key and if match found it set to zero and exit. Now I am trying to modify the script so that it searches for three values in stead one.

Basically where I have the value = "Dept1", I need to replace it with something like value in "Dept1","Dept2","Dept3". If any of these three values match found set to 0 and exit.

Any assistant or direction greatly appreciated.


Code:

' define variables
'
dim Arguments, Property_Key, Value, returnData, result
dim instanceValue, instanceValues, instanceValueArray
Dim regEx, matchFound

' Session Property_Key information to test for
'
Property_Key = "SE_ssgnames"
Value = "Dept1"

' define Arguments object and return scripting dictionary of User Session returned data
'
set Arguments = Permission.Arguments
result = 1

' - retrieve return data for the dictionary item only for this Property_Key
'
returnData = Arguments(Property_Key)

' split the return data for processing
'
instanceValues = Split(returnData, ",")

' loop through and validate the Values for a match,
' when a match is found, set the result to 0 and exit the loop
'
Set regEx = New RegExp
regEx.Pattern = replace(Value, "\", "\\")
regEx.IgnoreCase = True

for each instanceValue in instanceValues
  '
  ' check for each value
  '
  matchFound = regEx.Test(instanceValue) ' Execute search.
  if matchFound then
    result = 0
    exit for
  end if
next

set Arguments = Nothing
set regEx = Nothing

' return the result
'
Permission.Exit(result)
'

vbscript to find a strings id and perform some operations and export data to an excel

$
0
0
Hi Team

I am newbie to VBscript and looking for an help. There are many log files in a folder. I want to search a string string1 and get its id loaded to a variable var1. Then search another string2 within the same id var1 if it is found some data in the log within the same var1 id need to be exported to an excel.

Please let me know whether i can achieve this in VBscript. Any helps and suggestions are welcome

the log file contains like below line multiple lines.

Line 8122: Feb 01 19:44:40.961 | INFO | JEZHckpTehtA-ADSW4T14T5 | PROD | 10.86.99.108 | Feb 01 2016 19:44:29.595 | starts
Line 8123: Feb 01 19:44:40.961 | INFO | JEZHckpTehtA-ADSW4T14T5 | PROD | 10.86.99.108 | Feb 01 2016 19:44:29.595 | EVNT=SWIdmst|DQLN=YN| DQLN=EQUAL_QUAL_QUEUE_GOHEAD_IT
Line 8124: Feb 01 19:44:40.961 | INFO | JEZHckpTehtA-ADSW4T14T5 | PROD | 10.86.99.108 | Feb 01 2016 19:44:29.595 | EVNT=SWIdmst|DQLN=YN| INDX=1
Line 8125: Feb 01 19:44:40.961 | INFO | JEZHckpTehtA-ADSW4T14T5 | PROD | 10.86.99.108 | Feb 01 2016 19:44:29.595 | EVNT=SWIdmst|DQLN=YN| DQLN=Another_id
Line 8126: Feb 01 19:44:40.961 | INFO | JEZHckpTehtA-ADSW4T14T5 | PROD | 10.86.99.108 | Feb 01 2016 19:44:29.595 | EVNT=SWIdmst|DQLN=YN| Name=QID|Inputs=[accNumber=12457845,oon=6842703020]|Outputid=00a4028a87c4473f,amid=2353.6,TransactionTime=125ms
.........
Line 8160: Feb 01 19:44:40.961 | INFO | JEZHckpTehtA-ADSW4T14T5 | PROD | 10.86.99.108 | Feb 01 2016 19:44:29.595 | ends


String1 is: QUAL_QUEUE_GOHEAD_IT
Var1 is: JEZHckpTehtA-ADSW4T14T5
string2 is: Another_id
need to get details of accNumber=12457845,oon=6842703020,Outputid=00a4028a87c4473f,amid=2353.6 values to excel sheet.

I have the below code for it just started working on it,

Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\Users\shambu\Desktop\otq"
Set objFolder = objFSO.GetFolder(objStartFolder)
Dim varid

For Each objFile in objFolder.Files
set oStream = objFile.OpenAsTextStream(1)
If not oStream.AtEndOfStream Then
contents = oStream.ReadAll
End If
oStream.Close

Set re = New RegExp
re.Pattern = "INFO \| ([^\|]*) \|.*QUAL_QUEUE_GOHEAD_IT"
re.Global = True
Set matches = re.Execute(contents)

For Each match In Matches
varid = match.SubMatches(0)
ProcessMatch objFile.Path, varid
Next

Next
sub ProcessMatch(path, id)
Msgbox "Match " & id & " found in " & path
end sub

Need to raise an image higher in html

$
0
0
Hi all, I'm REALLY new at this. I know almost nothing about html. So I need some help. I downloaded a free template that's perfect for my website, but I needed to change the logo. So I created one on the net. But the logo I created is positioned lower than the original and doesn't look as good that way.

I've been looking at the code and I don't see a way to change where the image starts. Here's the "head" code:
Code:

  <header>
    <div class="container_24">
            <!-- .logo -->
            <div class="logo">
              <a href="index.html"><img src="images/logo.png" alt="Shades"></a>
      </div>
            <!-- /.logo -->
      <!-- .extra-navigation -->
      <ul class="extra-navigation">
              <li><a href="index.html" class="home current">&nbsp;</a></li>
        <li><a href="#" class="map">&nbsp;</a></li>
        <li><a href="index-5.html" class="mail">&nbsp;</a></li>
      </ul>
      <!-- /.extra-navigation -->
      <nav>
        <ul>
                <li><a href="index.html" class="current">Home</a></li>
          <li><a href="index-1.html">Support</a></li>
          <li><a href="index-2.html">Services</a></li>
          <li><a href="index-3.html">Download</a></li>
          <li><a href="index-4.html">Clients</a></li>
          <li class="last"><a href="index-5.html">Contacts</a></li>
        </ul>
      </nav>
    </div>
  </header>

Would really appreciate any help. I'm a fish out of water here.

Dllcalls in a vbscript

$
0
0
I am not sure, this is probably not the right subforum... I would like to have a simple vbs script which runs on every Windows PC without additional apps and tools.

Below is a short script written in AHK: A text string is extracted from a file and added as resource in an exe file by dllcalls.

Can this be reproduced in a simple way in vbs?

Thank you very much in advance!

ExeFile = MyExe.exe
ScriptF = Script.txt
FileRead, Script, %ScriptF%

VarSetCapacity(Bin, BinScript_Len := StrPut(Script, "UTF-8") - 1)
StrPut(Script, &BinScript, "UTF-8")

Module := DllCall("BeginUpdateResource", "str", ExeFile, "uint", 0, "ptr")

DllCall("UpdateResource", "ptr", Module, "ptr", 10, "str", ">MY SCRIPT<"
, "ushort", 0x409, "ptr", &BinScript, "uint", BinScript_Len, "uint")
DllCall("EndUpdateResource", "ptr", Module, "uint", 0)

VB script for window services

$
0
0
Hi

We are using vbs script to monitor the services in SAP application.Below script was already implemented.It is listing only some services in SAP(stopped and running) .Please help me in the script to list all the services.

Const ForAppending = 8
DIM prefix, prelen
DIM pattern
pattern="%"

Set objFSO = CreateObject("Scripting.FileSystemObject")
'Set objLogFile = objFSO.OpenTextFile("services.csv", ForAppending, True)
Set objLogFile = Wscript.StdOut
'objLogFile.Write("Service Dependencies")
objLogFile.Writeline
strComputer = "."

DIM name

if WScript.Arguments.length = 1 then
pattern = WScript.Arguments(0)
end if

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
query = "Select * from Win32_Service where Name like '" & pattern & "' AND ServiceType = 'Own Process' OR ServiceType='Interactive Process'"
WScript.Echo query

Set colListOfServices = objWMIService.ExecQuery(query)

prefix = "C:\WINDOWS\"
prelen = len(prefix)
For Each objService in colListofServices
If not startsWith(objService.PathName,prefix,prelen) Then
objLogFile.Write " service_name=" & objService.Name & ";service_type=ntsrv;service_caption=" & objService.DisplayName& ";service_user=" & objService.StartName & ";service_Executable=" & objService.PathName & ";service_resources=serviceName_"&objService.Name
objLogFile.WriteLine
End If
Next
objLogFile.Close


Function startsWith(str1, prefix,prelen)
startsWith = Left(LCase(str1),prelen) = LCase(prefix)

End Function

Thanks,
karthik
Viewing all 687 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>