Solved

Call EXE From VBScript, Trap Output, and Add Registry key

Posted on 2004-10-07
3
3,481 Views
Last Modified: 2012-05-05
I need to write a VBScript which will run an external command line EXE and trap the console output form this 3rd party tool.  Depending on the output, I need to add a registry key or not.

How would I go about this?

Thanks!
0
Comment
Question by:winterminute
  • 2
3 Comments
 
LVL 17

Expert Comment

by:zzzzzooc
ID: 12254500
   Dim objWShell, objWExec, strOutput
    Set objWShell = CreateObject("WScript.Shell")
    Set objWExec = objWShell.Exec("ping 127.0.0.1")
    strOutput = objWExec.StdOut.ReadAll()
    Call MsgBox(strOutput)
    Set objWExec = Nothing
    Set objWShell = Nothing
0
 
LVL 2

Author Comment

by:winterminute
ID: 12254526
Okay, cool -- We're half way there -- I need to check that output to see if a string exists.
The output will be differnet each time but there will be a status line which I need to check for.
0
 
LVL 17

Accepted Solution

by:
zzzzzooc earned 100 total points
ID: 12254810
You should supply an example output for both statuses and which you want to parse them for.

Nonetheless, here's an example of searching for a string within a string:

Private Sub Form_Load()
    'search "my string test" for "string".. will return true
    If StringFind("my string test", "string") = True Then
        Call MsgBox("Found string.")
    End If
    'search "my string test" for "no".. will return false
    If StringFind("my string test", "no") = True Then
        Call MsgBox("Found string.")
    End If
End Sub
Private Function StringFind(ByVal strSearchIn As String, ByVal strSearchFor As String) As Boolean
    If InStr(1, strSearchIn, strSearchFor, vbTextCompare) > 0 Then
        StringFind = True
    End If
End Function
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now