Enhance your computer experience with AutoHotkey

Are you finding yourself using the mouse more often than your keyboard? Does your keyboard feel a little bit neglected? Using AutoHotkey you can better integrate the keyboard into your regular routine, infinitely enhancing your computer experience.

Image credit: Locutus

What is AutoHotkey?

AutoHotkey is an extremely powerful scripting language. While its main purpose is to enhance the use of one’s keyboard (it allows users to do almost anything with the keyboard), many standalone programs have been built using AutoHotkey, such as the recently mentioned WinSorter.

AutoHotkey scripts revolve around the idea of remapping keys. To takes keyboard keys and maps them so they perform a function other than what they normally would. The general format of the code is relatively easy to follow:

hotkey::remapped key

However, as already mentioned, simple remapping of keys just scratches the surface of what AutoHotkey can do.

AutoHotkey Example 1: Get rid of the annoying Caps Lock key

One simple, but brilliant, example of what AutoHotkey can do is remapping the Caps Lock key to the Shift key (I love th is feature). For this, you can simply make a blank document containing this single line:


After saving the document with the file extension .AHK and double clicking on it, your Caps Lock button will become a third Shift key.

If you want to keep the Caps Lock key, say for use in a shouting match, you can make the script so Shift+Caps Lock initates Caps Lock. Do to this, add a new line in the same document1:


Now with the script activated, the Caps Lock key will act like a Shift key and pressing Shift + Caps Lock will initiate Caps Lock. (Pressing Shift + Caps Lock again deactivates Caps Lock, just like how normally pressing the Caps Lock key deactivates it when it is on.)

1: You can stack infinite lines of code or other scripts within one script/document. It’s super convenient!

Example 2: Remap the Windows Media Player pause button

Windows Media Player 12, the one bundled with Windows 7, is a great media player. However, aside from the codec issue, it has a major shortfall: When using Windows Media Player, you have to press either the giant blue play/pause button or Ctrl+P to pause whatever you are playing. With an AutoHotkey script you can pause media in Windows Media Player just my pressing the spacebar on your keyboard.

To pause media in Windows Media Player with your spacebar, either create a new .AHK script – like discussed previously – and add the following coding (you may also add the following code to an existing .AHK script):

GroupAdd,mplayer,Windows Media Player ;Adds Windows Media Player to the group mplayer
GroupAdd,mplayer,WMPTransition        ;Adds WMPTransition to the group mplayer
#IfWinActive,ahk_group mplayer        ;Makes commands only work in mplayer
Space::Send,{Media_Play_Pause}        ;Makes space bar send Play/Pause media button
#IfWinActive,                         ;Makes commands work in all windows again

As you can see, there are lots of semicolons in the code. As far as the script is concerned, text after semicolons is ignored. Text after semi-colons are just comments for someone reading the script to try to understand what is going on. You can delete text after semi-colons if you want, with no repercussions – the script will still function fully.

This script is from the Autohotkey forums, the best place to discuss all things AHK.

Example 3: Make Ctrl+V paste in Command Prompt

Want to use your keyboard to paste into Command Prompt? Good luck with that… because Bill Gates refuses to allow you to do this! Instead, to paste in Command Prompt one must right-click with the mouse and click on Paste. A simple AutoHotkey script can allow you to use Ctrl + V to paste into Command Prompt:

#IfWinActive ahk_class ConsoleWindowClass ;Checks for Command Prompt
^V::                                      ;If Ctrl+V is pressed...
SendInput {Raw}%clipboard%                ;Send the raw clipboard data
#IfWinActive                              ;Allows for other scripts

This script checks for Command Prompt and then “types in” the clipboard data whenever Ctrl + V is pressed.

Like the previously discussed scripts, the above script can either be entered into a whole new .AHK script, or it can be appended to an already existing script.

This example script is from Lifehacker, my favorite place to find new AHK scripts.

Making scripts run at booting time

Many AutoHotkey scripts are ones that users want to run all the time. So it makes sense to make them automatically start at Windows boot. To make a script run at Windows boot, simply create a shortcut to the respective AHK file and place it in the Startup folder. In other words,

  • Go to your .AKH file, right-click on it, and click on Create Shortcut.
  • Cut/copy the shortcut you just created.
  • Access the Startup folder by navigating to C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup if you are on Windows Vista/Win7 or C:\Documents and Settings\%username%\Start Menu\Programs\Startup if you are on Windows XP.
  • Paste the shortcut in the Startup folder:

Making scripts standalone

By default AutoHotkey needs to be installed to run a .AHK script. So what if you want to use the script on a computer where AutoHotkey is not installed (or want to share the script with someone that doesn’t have AutoHotkey installed)? To allow for AutoHotkey script usage anywhere, AutoHotkey allows users to compile scripts into standalone executables. These standalone executables can be used on computers where AutoHotkey is not installed.

To compile a script into a standalone executable, first open Windows Explorer and navigate to your script:

Then, right click on your script and hit Compile Script:

You’ll (almost) instantly get a second copy of the script, but this time it will be an executable file:

Take this executable wherever you want to use it. You can even share it with other people online.

There is one thing to note about compiled scripts (aka standalone executables), however. Due to some bad programming on someone’s part, some antiviruses detect AHK’s compiled scripts as viruses. While many of these detections are false-positives, there are bound to be malicious AHK-compiled executables out there. As always, exercise caution around executables, even if you made them. If you are suspicious about a file, running it through VirusTotal or Jotti will generally give you an idea as to if it is malicious or not.

Writing your own scripts

Copying someone else’s scripts is a quick and easy way to get things done. However, not only is copying not fun but someone may not have created a script that you need; so you may need to create your own script. Luckily, AutoHotkey is, as far as pseudo-programming languages go, fairly easy to code for. Here is a list of things you can do in AutoHotkey:

  • Remap & remake keyboard shortcuts with any and all keyboard buttons.
  • Send commands only to certain windows, like the previously mentioned Command Prompt one.
  • Make certain shortcuts open programs or websites with the Run command.
  • Add user interfaces to commands.
  • …Anything you can think of.

The capabilities of AutoHotkey are nearly endless. As already mentioned, not only is AutoHotkey used to tweak how users interact with their computers, entire programs have been crafted in AutoHotkey.

If you are looking to write your own AutoHotkey scripts – or even whole programs – the best place to start learning are the AutoHotkey tutorials.


AutoHotkey is an amazingly powerful program/scripting language and is a force to be reckoned with.  With AHK scripts, you have the power to do anything and everything with your keyboard… and then some. Sound too good to be true? Try it yourself, and find out!

Version reviewed: v1.0.90.0 of AutoHotkey_L

Download size: 2.50MB

Supported OS: All Windows

Malware scan: 2/43 detections – VirusTotal results*

*This has been a malware detection problem with AutoHotkey since the day it was created. As far as we know, AutoHotkey is a safe program. However, by proceeding to download AutoHotkey you recognize and accept any risk associated with the program. Me, Ashraf, dotTech, and anyone else are not responsible for any gain or loss incurred by use of AutoHotkey.

AutoHotkey homepage [direct download]

Related Posts

  • Mark

    This is indeed an incredible program. A bit intimidating at first to noobs like me, but once you get familiar with it, the possibilities are amazing. I highly recommend it, and am glad to see it getting recognition here.

    @Akbar: not sure why MS security essentials is reporting problems. I run MS SE as well and it detected no problems when I dl’ed and installed Autohotkey. As CyanIde noted, Autohotkey is definitely not malware.

  • Wow!!! It’s great to know that so many things can be done with the keyboards. I really had no idea about this. Read 1st few paras and due to lack of time now I could not read all. I am just noting down the url, so that I can read all later.

    Thanks for sharing such a helpful tips. I am bored of using mouse :(

    Keep writing :)
    Visit my website – http://www.aplusconferencing.com/ for Web Video-Audio Conferencing

  • CyanIde


    Your first mistake was installing MSSE. Your second mistake was listening to them. IMHO.

    Autohotkey is used by millions, world-wide. It isn’t malware

  • Dru

    I’ve been looking at AHK for a while and I’m glad to read this review to learn more. Nice job Locutus! You have really crystallized for me the main areas AHK can help me. I live and die by the command prompt and shortcut keys, I want faster and more efficient :)

    I have used MacroExpress (shareware/payware) for years and find it’s interface fantastically easy to create and manage macros of various complexity. Your article helps me understand where AHK excels ME, and suggests where ME excels AHK. AHK isn’t going to make me leave ME, however I do see how AHK can compliment to give me the upper hand against the mouse and GUI :)

  • Got to agree. Been a great fan for a while use, it daily – mainly to save typing
    The autohotkey site is a great source of info and scripts – if a bit difficult to navigate

  • @jivadasa: A 144MB floppy?! Where’d you get that!? That’s a small thumb drive! ;-)

    @Ashraf: I just realized this is a featured post :D

  • jivadasa

    What a dilemma! I have long been afflicted with CapsLock Finger. When I get a new keyboard, my first act has always been to pry the key loose and throw it in the recycling bin. I’ve tamed the Finger a bit, but it still sometimes strays. So I can use this tool; but my main interest is in the programming.
    I used to play with Hypercard in the Olden Days of Mac SE, and 144MB floppies. But I never got farther than that. This looks like a programming game that even old farts like me can manage. I drool for it!
    But I am scared by these two negative reports. One has been identified as Microsoft, who provide an option to report it as OK. But Microsoft security is, I believe, overzealous (that’s been my experience, giving security warnings when I visit my own Dropbox.com , or use the handy tinyurl.com .
    But I would like to know the other source too. Is there a way to do this?


  • Peter Stern

    I have written a script that gives a checkoff on shutting down the computer, so if you accidentally try to shut down rather than restart, or vice versa, you get a confirmation which allows you to back out. Also scripts to choose a window to close from a list even if it is not the active window and a script to choose a window to make active from a list of open windows.

  • Casey

    I’ve written several pretty cool scripts. I have one where you hit a hotkey, and your window becomes transparent (which is great for viewing windows behind it). It is a powerful program, but I have a few troubles “compiling” on vista. I’ve googled it, and there seems to be other people with similar problems, but no solution is found. Oh well.

  • Akbar

    Microsoft Security Essentials reported the following warning even during the download stage
    “The file you are downloading has been reported to be unsafe. The download website contains links to viruses and other software that can harm your computer or reveal your personal information.
    For your safety, we recommend you cancel this file download. ”
    Following two hyperlinked options was also given:
    Disregard and download the unsafe file(not recommended) – I went ahead with this after reporting as below.
    Report that this download is safe – – which led to Microsoft site to report the same as safe – which option I selected.
    What do you think?

  • greenlantern71

    Love it!! I’ve been using this for a few months now (I think it was reviewed here before???).

    Thanks for the CapsLock code! It would be nice though to have the code where you could lock the function instead of having to hold the shift+capslock buttons in order to do continuous caps. Just a thought if it can be done.

    dotTech rocks!!

  • PapyLuc

    AutoHotkey is a great creator of scripts, comprehensive but requires a lot of attention and effort. After the results are excellent. Personally I actually use the editor: PSPad for it is he who can access most easily help file.

    Autohotkey est un excellent créateur de scripts, très complet mais il exige beaucoup d’ attention et d’ efforts.
    Après les résultats seront excellents.

    Personnellement j’ utilise l’ editeur : PSPAD car c’ est celui qui permet d’ accèder le plus facilement au fichier d’ aide.

    PS : http://www.autohotkey.com/forum/ & BYE.

  • r0lZ

    I’m a big fan of AutoHotkey, and I wrote already several scripts. Thanks for this good introduction.

    However, there might be a bug in your first example:
    should be:

  • ZappedSparky

    Being a lefty this is going to be pretty great for altering the hot keys. Moving my right hand to the other side of the keyboard and then twisting it (in an uncomfortable way) to hit the right keys? Not anymore :)

  • Ashraf

    AutoHotkey is a brilliant program and this is a very good article introducing it! Let’s see if we can get some cool AHK scripts posted about on dotTech.