Solved

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

Posted on 2004-10-07
3
3,483 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

867 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

23 Experts available now in Live!

Get 1:1 Help Now