Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to make the best of use of Sublime Text in editing, running, and compiling AutoHotKey scripts.

Sublime Text, AutoHotKey, and You

If you're going to work with AutoHotKey scripts, I recommend that you download and install Sublime Text 3, which is an excellent editor for all sorts of languages, including AutoHotKey .AHK files. To get the most out of Sublime Text 3 when editing AHK files:

  1. Install Sublime Text Package Control, then,

  2. Install and Set Up the AutoHotKey Package the easy way:

    1. Enter the Sublime Text command palette by pressing Ctrl + Shift + P or by navigating to Preferences > Packages Control
    2. In the input field, type install and using your directional keys (up/down), highlight Package Control: Install Package and press Enter
    3. Now type autohotkey, and when all the results are filtered to just the one AutoHotKey package and it is highlighted, press Enter. This will install the AutoHotKey package.
    4. Once the AutoHotKey Package for Sublime Text is installed, we're going to need to edit the User Preferences File for AutoHotkey. In Sublime Text, navigate to Preferences > Package Settings > AutoHotKey then click on to open AutoHotKey Settings - User.
    5. Assuming AutoHotKey installed to C:\Program Files (x86)\ on your computer, paste the following code into the newly opened file (which should have the filename AutoHotKey.sublime-settings) and then save the file:
        {
            "AutoHotKeyExePath": {
                "default": "C:\\Program Files (x86)\\AutoHotkey\\AutoHotkey.exe"
            },
            "Ahk2ExePath": {
                "default": "C:\\Program Files (x86)\\AutoHotkey\\Compiler\\Ahk2Exe.exe"
            }
        }

Once you've completed all these steps, you'll have the ability to Run your AutoHotKey Scripts directly from within Sublime Text by pulling up Sublime Text's command pallete by pressing Ctrl + Shift + P and then selecting AutoHotKey - Run from the list (either by searching for AutoHotKey or navigating down the commands list). You'll also have the ability to compile executable (.exe) files from the Command Pallete as well by pulling it up and then selecting AutoHotKey - Compile. Nifty Stuff.

@hot4harddrives

This comment has been minimized.

Copy link

hot4harddrives commented Oct 23, 2019

Bookmarked these instructions for later- thank you!

I have always used SciTEforAutoHotkey, but it hasn't been updated in a long time, and can be difficult to install on new machines. Can you compare Sublime to SciTEforAutoHotkey? Just wondering what I might be missing out on...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.