Jump to content
Sign in to follow this  
dewclaws

shell out and wait but capture the output

Recommended Posts

dewclaws

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

Share this post


Link to post
Share on other sites
Jos

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
dewclaws

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

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×