Jump to content
Sign in to follow this  
JonnyThunder

How to output to stream

Recommended Posts

JonnyThunder

Hello,

We use a package delivery system which can feedback the output from scripts run on a target PC. If we were to run a DOS batch file with the following, it would be fed back into the job output of our delivery system....

Echo This is my job output >> %1
Echo for the batch file I just ran >> %1

My question is, what would be the alternative within AutoIT. Is it even possible? I tried ConsoleWrite, but it doesn't work.

Thanks in advance,

JT

Share this post


Link to post
Share on other sites
KaFu
KaFu

#include <Constants.au3>

Local $foo = Run(@ComSpec & " /c Echo This is my job output && Echo for the batch file I just ran", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
Local $sStdout, $sStderr
While 1
    $sStdout &= StdoutRead($foo)
    If @error Then ExitLoop
Wend

While 1
    $sStderr &= StderrRead($foo)
    If @error Then ExitLoop
Wend

MsgBox(0, "Debug", "Output:" & @crlf & $sStdout & @crlf & @crlf & 'ErrorMsg:' & @crlf & $sStderr)

Share this post


Link to post
Share on other sites
JonnyThunder

Ahh it's cool. We figured out the software delivery tool is passing a filename which is used for the output. We can open that file directly and dump the output to it.

Cheers for the responses though.

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  

×