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.
#RUNESCAPE ASSIGN HOTKEY FULL#
You can find a full list of AHK’s modifiers in official documentation, but we’ll focus on the most useful (and cool) features. ahk file and set it to run in the background, always looking for hotkeys to remap.
You can place as many of these as you’d like in a. Just like that, you’ve defined a simple key-to-action mapping. You can have any number of actions before the return. They will all fire sequentially. The block is finished with a return at the end. The next line is an action. In this case, the action launches an application with the Run command. After that, there’s a double colon (::) to signify the start of an action block.
#RUNESCAPE ASSIGN HOTKEY WINDOWS#
The pound sign (#) is short for the Windows key and c is the C key on the keyboard. 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.