Sign in to follow this  
Followers 0

Log ConsoleWrite output in Scite

1 post in this topic

Posted

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

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  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.