

Clicking the mouse, with positioning relative to the current window.In fact, AHK is sometimes erroneously flagged as cheat software for video games, since people have made fully functioning aimbots with it. Sending input, whether it’s text or various button presses.We can’t possibly explain all of them, so we’ll pick out some useful ones. ActionsĪn action in AHK is anything that has an outside effect on the operating system. It will automatically remove the matched text to replace the hotstring, too, although this behavior can be adjusted. The hotstring will match the string only if it’s typed exactly. This is similar to how autocorrect works-in fact, there’s an autocorrect script for AHK-but supports any AHK action. AHK has a lot of directives, and you can find all of them in the docs.ĪutoHotkey also has hotstrings, which function like hotkeys except replacing a whole string of text. When AHK receives the input “Win+C,” it will fire the action under the first #IfWinActive only if the directive returned true, and then check the second one if it didn’t. The directive here is checking if a specific window is open, defined by ahk_class Notepad. This directive won’t change until you hit another directive, but you can reset it with a blank #If (and if that seems like a hack, welcome to AHK). Any hotkey after it will only fire if the condition is true, and you can group multiple hotkeys under one directive. The green #IfWinActive is called a directive, and applies additional context to hotkeys physically under it in the script. Let’s break down an example from the AHK docs: This is where modifiers, which let you do crazier things, come in. You can combine as many keys as you’d like into one hotkey, but you’ll soon run out of key combinations to remember. You can even reference other non-keyboard input devices with a small extension). (Spoiler: You can reference nearly much every key. Take a look at the key list for everything you can reference. You can also differentiate between left and right Alt, Control, and Shift with the modifiers, which opens up a lot of room for extra hotkeys. For example, # ! ^ + are Windows, Alt, Control, and Shift, respectively. Modifier keys all have single character shorthands. Here’s a basic AHK script that launches Google Chrome whenever you press Windows+C: #c:: There are a lot of different actions, hotkey combinations, and control structures, but all scripts will operate on the same principle. They’ll also go away when you sign out of Windows or reboot your PC, of course.Īt its core, AHK does one thing-bind actions to hotkeys. To exit, pause, reload, or edit a script, right-click the notification icon and select an appropriate option. Scripts will continue to run in the background until you exit them. Look for the green icon with an “H” on it. While a script is running-whether it’s an EXE or not-you’ll find it running in the background in the Windows notification area, also known as the system tray. You can use Notepad to write AHK scripts, but we recommend using SciTE4AutoHotkey, an editor for AHK which supports syntax highlighting and debugging. “Edit Script” will open your script in your default text editor.“Compile Script” will bundle it with an AHK executable to make an EXE file you can run.“Run Script” will load your script with the AHK runtime.If you right-click them, you’ll get a few options:
