Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-10-07
3
Medium Priority
?
3,498 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 400 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

Industry Leaders: 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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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 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…
Suggested Courses

722 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