Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

AutoHotkey – Mouse and Keyboard Remapping, Macros and Hotkeys


How do I create a hotkey for entering my email address? I seem to do this dozens of times a day and it seems to be a chore!

Have I got a recommendation for you. The only caveat is that it’s a tad geeky to set up, but it’s incredibly powerful. I run it on both my Windows XP desktop and Vista laptop.

AutoHotkey is a free, small program that remains running in your notification area. It intercepts keystrokes (and mouse activity, if you like), and allows you to configure anything from simple remapping of one key to another, to simple text insertion, as you’ve described, to complex actions that are nearly little programs in and of themselves.

One thing that’s easy to overlook is that AutoHotkey works at the keyboard level and is not tied to any application. So, anything you use it for is available at any time, regardless of what program you happen to be using.

My needs are fairly simple, so let me show you some of the things that I have AutoHotkey configured to do.

Become a Patron of Ask Leo! and go ad-free!

“Automate almost anything by sending keystrokes and mouse clicks.”
  • I find myself typing “” a lot, so I have the key sequence “]ta” mapped to that. Any time I type “]ta”, in any application, “” is inserted instead.
  • My 8 line email signature (one of several) is automatically typed in for me in response to “]th”. I can use that directly in my email program, in a text editing program, or even across a remote desktop or terminal session.
  • The sequence “]dd” inserts the current date like this:
  • I happen to run “xplorer2” instead of Windows Explorer, so I have the WindowsKey+E keystroke remapped to start xplorer2 instead of Windows Explorer.
  • My Caps Lock key, which I never use for Caps Lock, has been remapped into a MUTE button.

You get the idea. I also have a few shortcuts for common HTML elements that I find myself entering frequently.

Don’t let the “]xx” format of my shortcuts throw you either, I chose that. In reality, it can be anything you want – “btw” could automatically type in “by the way”, for example. I just chose something that I’d be unlikely to actually ever want literally.

Here are some more ideas from the AutoHotkey home page:

  • Automate almost anything by sending keystrokes and mouse clicks. You can write a mouse or keyboard macro by hand or use the macro recorder.
  • Create hotkeys for keyboard, joystick, and mouse. Virtually any key, button, or combination can become a hotkey.
  • Expand abbreviations as you type them. For example, typing “btw” can automatically produce “by the way”.
  • Create custom data-entry forms, user interfaces, and menu bars. See GUI for details.
  • Remap keys and buttons on your keyboard, joystick, and mouse.
  • Respond to signals from hand-held remote controls via the WinLIRC client script.
  • Convert any script into an EXE file that can be run on computers that don’t have AutoHotkey installed.

The approach I’m using – hand coding the AutoHotkey macros – can seem a tad geeky, because, well, it is. Here’s the AutoHotkey code to type in “”:


“SendEvent” sends keystrokes, but the more confusing part is that “:*:]ta::” part, which defines when the macro should kick in. Once you have that, the rest is fairly easy.

That aside, even with my simple usage I’ve only skimmed the surface of what AutoHotkey can be used for. Certainly, for simple things like text replacement or keystroke remapping, it’s a near perfect solution.

I recommend it.

Do this

Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.

I'll see you there!

16 comments on “AutoHotkey – Mouse and Keyboard Remapping, Macros and Hotkeys”

  1. Thanks Leo, just installed autohotkey, and run the test example – very impressive – this will save me hours of tedious typing – thank you AGAIN – more useful advise!

  2. For many years I’ve used a program called My Function Keys. With this, you assign text to the normally useless F keys. A single keystroke is all that is needed. It costs about 12.00 or so. You can even move the text files to other computers so that all you computers behave the same.

  3. Hello Leo, I tried AutoHotkey for a while and made a few keyboard shortcuts, but then gave it up because it’s a little too geeky and I couldn’t find a good set of instructions. I would need a task-oriented manual if possible.

    Is there an “AutoHotkey for Dummies” or equivalent?

    This is a good program for those who have the patience to learn to use it.


  4. I love AutoHotKey! I use it to start applications that I use frequently but don’t want open all the time, or a set of apps I use for presentations. I’ve also created some scripts to get to control panel apps without all the pointing and clicking.
    As for instructions, there are people who have posted their AHK scripts for others to use. I learned quite a bit from seeing other scripts.

  5. I use the My Function Keys program suggested above by Ron. It has changed a bit. Only the F1 thru F4 keys are programmable, but there is no cost. Very simple to set up and a real time saver.

  6. I would also like to recommend the freeware Windows automation engine AutoIt. Much of AutoHotKey’s scripting style is based on the old version 2 of AutoIt; AutoIt itself is now in version 3 and has been for years.
    As a point of disclosure, I am one of the developers of AutoIt.

  7. WOW!! Thanks for introducing me to AutoHotkey.
    Took a bit of savy but now it is so easy and I am using it in all my corespondance.
    Keep up the good work

  8. I find the CAPS LOCK key irritating to the extreme simply because it is so easy to activate the CAPS LOCK and end up typing several lines in unwanted upper case. Could you please advise how to inactivate this key without interfering with the SHIFT KEY function.

    Many thanks in anticipation.

  9. I first tried this out a few years ago when you first recommended it, but I found it a little too geeky. Two years later, after using your advice to install Ubuntu Linux on an old machine to give it a new lease on life, I have become much more of a geek. Now I have fallen in love with AutoHotkey and have it on my Windows desktop.

  10. It would have been more helpful, to me, if you mentioned how do you access the AUTOHOTKEY feature.

  11. @Charlie Pelissier:
    Simply go to
    You might also find it useful to look at

    I was delighted to find I could force CapsLock to be always off, but never thought to use it as a Mute toggle.

    Please note that the version of AutoHotkey being actively maintained and developed is AutoHotkey_L, from the same source.

    One of the most useful shortcuts I have transposes the characters on either side of the insertion point – absolutely anywhere.

    And if, like me, you have a TrueCrypt volume in Dropbox, it’s very useful to be able to ensure it’s dismounted before suspending Windows.

    And life is much simpler if you use a text editor which can highlight AHK syntax appropriately, such as TextPad or NotePad++.

  12. I was interested in the AutoHotkey discussion because of the problems I’ve had in creating macros in MS Word 2010. I used to write some complex macros before the 21st century arrived, but now when I try to create a macro, 1) it doesn’t seem to work, and 2) you are warned that macros may compromise your computer because, I think, of their interference with program language. I got the impression that a macro might make you more vulnerable to hackers. I like macros better than Word’s QuickParts. Once you have inputted all the keystrokes, one keystroke combo activates them and saves you all kinds of time. I wonder why they are now warning us about macros. Are macros in Word that dangerous?

  13. I wonder if it can do control-5. Windows does not process some codes and if Autohotkey does not intercept the keyboard itself it will never see control-5 and many other combination codes. I’m hoping…


Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.