jfitzger Posted October 31, 2008 Share Posted October 31, 2008 I have tried a couple of ways to capture STDOUT from an exe but have not been succesful.. Any help would be appreciated Here is what I have tried Local $runPID = Run (@ComSpec & " /c " & 'hostname > C:\hostname.cfg') ; put it to a file to parse later from a dos command #include <IE.au3> #include <file.au3> #include <array.au3> #include <ClipBoard.au3> #include <Constants.au3> Local $foo = Run ("c:\test.exe test1 test2 ") MsgBox (0,"test", "this is the PID test.exe" & $foo) ;Got the PID fine Local $output = StdoutRead($foo) MsgBox (0,"stdoutread","this is camip" & $output) ;did not get any output Link to comment Share on other sites More sharing options...
Pain Posted October 31, 2008 Share Posted October 31, 2008 Look at the Run parameters. 2 ($STDOUT_CHILD) = Provide a handle to the child's STDOUT stream. Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 31, 2008 Share Posted October 31, 2008 I have tried a couple of ways to capture STDOUT from an exe but have not been succesful.. Any help would be appreciated Here is what I have tried Local $runPID = Run (@ComSpec & " /c " & 'hostname > C:\hostname.cfg') ; put it to a file to parse later from a dos command#include <IE.au3>#include <file.au3>#include <array.au3>#include <ClipBoard.au3>#include <Constants.au3>Local $foo = Run ("c:\test.exe test1 test2 ")MsgBox (0,"test", "this is the PID test.exe" & $foo) ;Got the PID fineLocal $output = StdoutRead($foo)MsgBox (0,"stdoutread","this is camip" & $output) ;did not get any outputYou need your $STDOUT_CHILD parameter, as already pointed out. I haven't tested it, but because you are using redirection (">") on the actual command line, I don't think you are going to get that data anyway. If you need to see the standard out data, and then later need it in the file, take the redirection off and have the AutoIt script write it to file after you get it all from StdOutRead(). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
jfitzger Posted October 31, 2008 Author Share Posted October 31, 2008 Look at the Run parameters.2 ($STDOUT_CHILD) = Provide a handle to the child's STDOUT stream.what is the handle? The handle you get back seems to be for the run command not the child Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 31, 2008 Share Posted October 31, 2008 what is the handle? The handle you get back seems to be for the run command not the childIn your example, $RunPID will be the PID of the instance of CMD.exe that is running (specified by @ComSpec). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now