Wednesday, March 12, 2008

What is a Hotkey?


In AutoHotkey, you can create keyboard shortcuts or remap keys easily in more than one way, but today we're going to focus on one method: Hotkey labels. The syntax of creating a hotkey is very simple, and can be used in two ways.

First, if you want to do something very simple—like remap a key—it looks like this:

hotkey::remapped key

...where hotkey is the keyboard shortcut that will activate the second part—in this case, a remapped key. That may seem rather vague, so let's look at a concrete example. I don't like the Capslock key as is, preferring instead to remap it to my Control key. With AutoHotkey, all it takes is:


If you add that small snippet of code to the AHK file you created above and then run the file (just double-click it), you'll notice that your Capslock key now works as a control key instead. Now not only have you got your control key at a much closer, less stressful range for your pinky, but you're not likely to accidentally fire the Capslock key when you don't want it. However, if you don't want to lose the Capslock key altogether—as there are times it can come in handy—you can add the following to your AutoHotkey script (Thanks mc_spanky_mcgee):


With this hotkey, the plus sign (+) stands for Shift, so hitting Shift+Capslock will turn on and off the Capslock key so that turning on Capslock requires a much more deliberate process. For a full list of modifiers you can use to create hotkeys, check out this page. For a better idea of which symbols you can use, from Capslock to Tab to the Spacebar, check out the full AutoHotkey key list.

So far so good, right? You can actually remap almost any key in this way—including regular, non-modifier keys. So if you wanted to turn your "k" key into an "i", it'd be as simple as:


Not that remapping k to i would be terribly useful, but you get the idea. It is terribly simple.


Post a Comment

Related Articles

Related Article Widget by Hoctro

About Me


Hi, I am Hua, a chinese expat residing in India excited about windows, linux and all things tech

Receive updates for free

Enter your email address:

Delivered by FeedBurner

Mobile Version


Bookmark and Share

Blog Archive