Jump to content

Recommended Posts

Posted

I have a simple VBS that I need to execute and read the output? I did a few minutes of searching and could not find a method of doing this.

- Dewclaws

Dewclaws

  • Developers
Posted (edited)

Should work fine bij doing (untested):

; Demonstrates StdoutRead()
#include <Constants.au3>

$foo = Run(@ComSpec & " /c cscript script.vbs", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

While 1
    $line = StdoutRead($foo)
    If @error Then ExitLoop
    MsgBox(0, "STDOUT read:", $line)
Wend

While 1
    $line = StderrRead($foo)
    If @error Then ExitLoop
    MsgBox(0, "STDERR read:", $line)
Wend
Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Thanks for the help. That worked!

Should work fine bij doing (untested):

; Demonstrates StdoutRead()
#include <Constants.au3>

$foo = Run(@ComSpec & " /c cscript script.vbs", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

While 1
    $line = StdoutRead($foo)
    If @error Then ExitLoop
    MsgBox(0, "STDOUT read:", $line)
Wend

While 1
    $line = StderrRead($foo)
    If @error Then ExitLoop
    MsgBox(0, "STDERR read:", $line)
Wend

Dewclaws

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...