Sends any syntax error that prevents a script from launching to stdout rather than displaying a dialog.
#ErrorStdOut |
Parameters
None
Remarks
This allows fancy editors such as Textpad, Scite, Crimson, and EditPlus to jump to the offending line when a syntax error occurs. See below for setup instructions.
Although syntax errors are sent to standard output (stdout), they cannot currently be displayed at the command prompt. However, you can have the command prompt redirect the output to a file as in this example:
"C:\Program Files\AutoHotkey\AutoHotkey.exe" /ErrorStdOut "My Script.ahk" >"Error Log.txt"
You can also pipe the output directly to the clipboard by downloading cb.zip (4 KB) and then following this example:
"C:\Program Files\AutoHotkey\AutoHotkey.exe" /ErrorStdOut "My Script.ahk" |cb.exe
Since this directive would have to be added to every script, it's usually better to set up your editor to use the command line parameter /ErrorStdOut when launching an AutoHotkey script.
Instructions for specific editors:
EditPlus:
From the menu bar, select Tools > Configure User Tools.
Press button: Add Tool > Program
Menu Text: Your choice
Command: C:\Program Files\AutoHotkey\AutoHotkey.exe
Argument: /ErrorStdOut "$(FilePath)"
Initial directory: $(FileDir)
Capture output: Yes
TextPad:
From the menu bar, select Configure > Preferences.
Expand the Tools entry.
Press the Add button and select "Program".
Copy and paste (adjust to your path): C:\Windows\System32\cmd.exe -- then press OK.
Triple-click the newly added item (cmd.exe) in the ListBox and rename it to your choice (e.g. Launch Script).
Press Apply.
Select the new item in the tree at the left and enter the following information:
Command (should already be filled in): cmd.exe (or the full path to it)
Parameters (adjust to your path, if necessary): /c ""C:\Program Files\AutoHotkey\AutoHotkey.exe" /ErrorStdOut "$File""
Initial folder: $FileDir
Check the following boxes:
1) Run minimized; 2) Capture output.
Press OK. The newly added item should now exist in the Tools menu.
Related
FileAppend (because it can also send text to stdout)
Example
#ErrorStdOut