bo8ster Posted April 8, 2010 Share Posted April 8, 2010 Taken from here. I hope this will help people understand the functions used more. This works using two scripts, one is your normal script you want to capture the output from and the other is used to capture the output.I have used a msgbox but you can replace that with a FileWrite.Script One - My custom script where I want to save the output. Fancy I know! Note comments are not written using #AutoIt3Wrapper_Run_Debug_Mode=Y#AutoIt3Wrapper_Run_Debug_Mode=Y AutoItSetOption("SendKeyDelay", 90); AutoItSetOption("MustDeclareVars", 1) ConsoleWrite(@CRLF & @CRLF & " Hello world" & @CRLF & " This is a test" & @CRLF & @CRLF) ;~ End of script ExitScript Two - Used to execute and capture the output of Script One. Most of it I copied from the help file. The run cmd I got from Scite when Pressing F5. I believe everything comes from STDOUT so STDERR is not really required but its there. Using this $line can be written to a file if required. #include <Constants.au3> Local $foo = Run('"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\<....>\workspace.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams', @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $line While 1 ProcessWaitClose($foo) $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend While 1 ProcessWaitClose($foo) $line = StderrRead($foo) If @error Then ExitLoop MsgBox(0, "STDERR read:", $line) Wend Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] 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