Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Log ConsoleWrite output in Scite


  • Please log in to reply
No replies to this topic

#1 bo8ster

bo8ster

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,189 posts

Posted 08 April 2010 - 04:58 AM

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 Exit



Script 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)Brett F's Learning To Script with AutoIt V3Valuater's AutoIt 1-2-3, Class... is now in SessionContribution: Get SVN Rev Number, Control Handle under mouse, A Presentation using AutoIt, Log ConsoleWrite output in Scite










0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users