Sublime Text Resources - [plugins, lang files, etc.]
Posted: 02 Oct 2013, 08:17
This thread is for users of Sublime Text (2|3) who wants to share their AutoHotkey configuration/setup for the said text editor. To start with, below is a link to my custom sublime plugin that enables the user to run/build AHK scripts (saved or unsaved). By passing some special parameter(s) to the command, the user can:
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):
As key binding: (pressing F5 will run code in active Sublime Text view)
**Tip/trick: Bind the command to a hotkey, type any AHK code in the Sublime Text console(use "\n" to indicate new lines = e.g.[do not include quotes]: "MsgBox, Hello Word\nreturn") , press the hotkey - the code is ran dynamically.
Here is the link to the Python script: ahk.py
UPDATE:
NOTE: For now, the provided script is for Sublime Text 3 [beta] which uses Python 3.x. I will be posting a Sublime Text 2 compatible script.
- 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.