- open AutoHotkey CHM Documentation
- run Window Spy
- run dynamic code
- run a script
USAGE/EXAMPLE:
First save the Python script as ahk.py and put it in your AutoHotkey package folder.
Calling it from the Sublime Text Console: (type the following in the console):
Code: Select all
view.run_command("ahk", {"cmd":"$help"}) # opens documentation
OR
view.run_command("ahk", {"cmd":"$win_spy"}) # runs Window Spy
OR
view.run_command("ahk", {"cmd":None}) # runs code from active Sublime Text view
OR
view.run_command("ahk", {"cmd":"C:\\Users\\MyUser\\Documents\\AutoHotkey\\some_ahk_script.ahk"}) # run script in HD
OR
view.run_command("ahk", {"cmd":"MsgBox, Hello World\nreturn"}) # run dynamic AHK code
Code: Select all
[
{
"keys": ["f5"],
"command": "ahk",
"context": [
{ "key": "selector", "operator": "equal", "operand": "source.ahk" },
]
},
{
"keys": ["f5"],
"command": "ahk",
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.plain" },
]
}
]
Here is the link to the Python script: ahk.py
UPDATE:
Code: Select all
CHANGELOG(topmost-recent):
10/20/13 - Added ability to pass arguments to script via 'args' parameter - 'args' should be a sequence/list/array of script arguments. For temp/unsaved script(s): if 'include_print' parameter is set to 'True'(default is True), a 'print(str)' function will be appended to the code. Calling this function from AHK will write 'str' to stdout, in this case, captured by Sublime Text's console - useful for debugging. Renamed 'param' parameter to 'cmd'.
10/09/13 - AHK scripts (whether from file or string) is now launched with the "/ErrorStdOut" switch. Runtime error(s) and #Warn warnings(if 'WarningMode' parameter is set to 'StdOut') are now displayed in Sublime Text's console.