Solved

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

Posted on 2004-10-07
3
3,496 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

623 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