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