Sends subsequent load-time errors and uncaught runtime errors to the standard error stream (stderr) rather than displaying a dialog.
#ErrorStdOut
If this directive is unspecified in the script, load-time and uncaught runtime errors are normally displayed in a dialog.
Errors are written to stderr instead of stdout. The command prompt and fancy editors usually display both.
An uncaught runtime error is written as File (Line) : ==> Message, followed by a line reading Specifically: Extra when the error's Extra is not empty.
This allows editors such as TextPad, SciTE, Crimson, and EditPlus to jump to the offending line when a syntax error occurs. The /ErrorStdOut command-line switch can be configured in an editor to route load-time errors for every script, but it does not route uncaught runtime errors; use the directive when both are needed.
Because AutoHotkey is not a console program, errors will not appear at the command prompt directly. This can be worked around by 1) compiling the script with the #App ConsoleApp key, or 2) capturing the script's output via piping or redirection. For example:
"C:\Program Files\AutoHotkey\AutoHotkey.exe" /ErrorStdOut "My Script.ahk" 2>&1 |more "C:\Program Files\AutoHotkey\AutoHotkey.exe" /ErrorStdOut "My Script.ahk" 2>"Syntax-Error Log.txt"
You can also pipe the output directly to the clipboard by using the operating system's built-in clip command. For example:
"C:\Program Files\AutoHotkey\AutoHotkey.exe" /ErrorStdOut "My Script.ahk" 2>&1 |clip
Note: 2>&1 causes stderr to be redirected to stdout, while 2>Filename redirects only stderr to a file.
Like other directives, #ErrorStdOut cannot be executed conditionally.
EditPlus:
C:\Program Files\AutoHotkey\AutoHotkey.exe/ErrorStdOut "$(FilePath)"$(FileDir)TextPad:
C:\Windows\System32\cmd.exe -- then press OK.cmd.exe (or the full path to it)/c ""C:\Program Files\AutoHotkey\AutoHotkey.exe" /ErrorStdOut "$File""$FileDirFileAppend (because it can also send text to stderr or stdout)