test.ahk:
Code: Select all
SetTimer, TooLong, 5000
msgbox, Testing!
ExitApp
TooLong:
ExitApp, 666
Code: Select all
autohotkey test.ahk
echo %errorlevel%
I also tried with PowerShell:
Code: Select all
$Proc = start-process -filepath autohotkey -argumentlist .\test.ahk -passthru
$handle = $proc.handle # See: https://stackoverflow.com/a/23797762
Write-Host $proc.exitcode
These appear to be giving me the errorcode that indicates the script was *started* successfully. How can I capture the completion error code I am exiting with?
Thanks.