Skip to content

Instantly share code, notes, and snippets.

@AWMooreCO
Last active June 23, 2023 20:27
Show Gist options
  • Save AWMooreCO/d0308bab265cc8c5e122 to your computer and use it in GitHub Desktop.
Save AWMooreCO/d0308bab265cc8c5e122 to your computer and use it in GitHub Desktop.
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
Copy link

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...

@genido
Copy link

genido commented Dec 15, 2021

hot4harddrives ... Bookmarked these instructions for later- thank you!

Me too, thanks a lot!
... and about your question, if and how much I could answer, SciTE (good) | Sublime (contemporary, good, extendible) | ATOM(maybe the future)

cheers mates!

@dkzeanah
Copy link

dkzeanah commented Oct 1, 2022

how can I alter this to provide v2 code completions? any advice/direction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment