I think similar to
Part of the problem is how the 'Console' works in an uncompiled script. You're running it through the AutoIt.exe process, not through SciTE or its own process. You're not inputting into the 'correct' console window, is basically my thought.
So, basically, you cannot do what you want unless you compile the script, and do you things from the console window of the direct .exe file. As for why Execute is not working, that's because of CR/LF/CRLF, basically. I tested your code, and some example code built from the help file entry for Execute, and I got it working:
#include <MsgBoxConstants.au3>
#cs
Compile this script to "ConsoleRead.exe".
Open a command prompt to the directory where ConsoleRead.exe resides.
Type the following on the command line:
echo Hello! | ConsoleRead.exe
When invoked in a console window, the above command echos the text "Hello!"
but instead of displaying it, the | tells the console to pipe it to the STDIN stream
of the ConsoleRead.exe process.
#ce
; MouseClick("main", 436, 451, 1, 10) ; Copy this and try executing that, or whatever you want
Example()
Func Example()
If Not @Compiled Then
MsgBox($MB_SYSTEMMODAL, "", "This script must be compiled in order to run the example.")
Exit
EndIf
Local $sOutput
While True
Sleep(25)
$sOutput = ConsoleRead()
;~ If @error Then ExitLoop
If $sOutput <> '' Then
MsgBox($MB_SYSTEMMODAL, "", "Received: " & @CRLF & 'Type: ' & VarGetType($sOutput) & @CRLF & $sOutput)
Execute(StringStripCR(StringStripWS($sOutput, 1 + 2))) ; $STR_STRIPLEADING + $STR_STRIPTRAILING
If @error Then
MsgBox($MB_SYSTEMMODAL, "", "Execute $sOutput error: " & @CRLF & @CRLF & @error)
EndIf
EndIf
WEnd
MsgBox($MB_SYSTEMMODAL, "", "Received: " & @CRLF & @CRLF & $sOutput)
EndFunc ;==>Example
Give that a shot (compiled) and see if it works for you, it did for me (sending the MouseClick line in there). Keep in mind then that this will only work for single line things.
Edit: Also take a look at https://www.autoitscript.com/autoit3/docs/intro/running.htm, specifically: AutoIt specific command Line Switches
And keep in mind that to use AutoIt3ExecuteScript or AutoIt3ExecuteLine, the file needs to be compiled with this flag:
#pragma compile(AutoItExecuteAllowed, true)