How-To Geek

The Beginner’s Guide to Using an AutoHotkey Script

AHK post

AutoHotkey scripts are a great way to customize your computer, but may seem daunting at first. Don’t worry – getting started is much easier than it looks! Read on to see.

[Image: mlinksva]

Getting AutoHotkey

The first thing you want to do is download and install AutoHotkey. Go to the AutoHotkey download page. You will be presented with a number of download links:


Click the first one, the installer for AutoHotkey_L. Save it to your hard drive – that’s what we’re going to use.

A Bit of History: Why Are There Two Versions?

You may be wondering why the download page offers both AutoHotkey_L and AutoHotkey Basic. What happened is that AutoHotkey’s original developer decided to stop working on the project; but AutoHotkey wouldn’t die so fast. Since the project is open-source and has an vibrant developer community, a number of efforts to continue development were started. Out of these, AutoHotkey_L was chosen as “AutoHotkey’s future”, and is now offered on the official download page.

Installing AutoHotkey

Okay, now that you’ve downloaded the executable, it’s time to set it up. The installer is fairly straightforward except for this next step which offers multiple choices:


We recommend to keep this at the default, Unicode 32-bit. If you’re running a 64-bit version of Windows you could opt for the 64-bit Unicode version, but it doesn’t offer significant performance gains for most scripts. Regarding ANSI, you should  only choose this option if there’s a specific script you’d like to run which you know for sure doesn’t play well with Unicode. This very rarely happens.  Bottom line: unless you have a good reason, stick to the default and click Next.

Getting The Script: Saving a Snippet

Now that you’ve got AutoHotkey set up, it’s time to get your first script. Some AutoHotkey scripts are so short, they’re posted online as short snippets of text. You can see one such script in our recent post about How to Fake Back and Forward Buttons With a Three-button Mouse. Select the script text and copy it:


Now run Notepad and paste the script in. Make sure you got the whole thing, from the very beginning to the end.


Next, save the file somewhere on your computer. The filename doesn’t matter, but the extension must be AHK. If you installed the Unicode version of AutoHotkey_L, it would be a good idea to save the script with Unicode encoding. Most scripts would probably work if you save them using the default encoding (ANSI), but Unicode is a safe option.



Pro Tip: Understanding Character Encodings

If you find all this talk about Unicode and ANSI a bit confusing, you might want to take a quick look at our recent post explaining What Are Character Encodings and How They Differ.

Getting The Script: Saving a File

Some scripts go on for more than just a few lines; these are often offered as files rather than pasted in-page. We recently posted one of these larger scripts under How to Get Spelling Autocorrect Across All Applications on Your System, so that’s what we’ll use for the example. Right-click the link to the AHK file and select to save it locally:


Again, make sure you save it as an AHK file.

Running The Script

You should now have an AHK file somewhere on your system, and AutoHotkey all set up. Simply double-click the AHK file to run it.


When the script is running, you should see a small icon in your system tray. Hovering over this icon with your mouse will pop up a tooltip showing the name of the script. AutoHotkey and AutoHotkey_L use slightly different icons.


If Your Script Doesn’t Work

Most scripts work right off the bat. However, if your script won’t run and pops up an error message, go back to the AutoHotkey download page and get “AutoHotkey Basic” (the second option). Uninstall AutoHotkey_L, Install AutoHotkey Basic and try running the script again.

You can also go back to “Saving a Snippet” and try saving the script with a different character encoding.

Exiting the Script

When you’re done working with a script, right-click its system tray icon and select Exit.


A technical writer for Tibbo Technology by day, Erez is obsessed with customizing anything and everything. After years of using Litestep and Blackbox, switching to a custom keyboard layout (Colemak), extending Word and Excel with elaborate VBA, losing weight with an AutoHotkey script he developed and spending countless hours tweaking Foobar2000 to get it to look "just right", Erez decided the time has come to share some of this obsession with the world at large.

  • Published 03/21/11

Comments (18)

  1. Peter


    thanks for this great tutorial! I got my first script running in no time.

    While we are at AHK, do you know of any good repository of useful ahk scripts?


  2. BrianA

    @Peter – start with the AHK site “Documentation” and “Forum”.

  3. Hatryst

    That was simple enough ;) And i thought AHK was only for programmers !
    More tutorials please !

  4. Barry

    Peter, there are a whole boatload of scripts at the Autohotkey site. In fact, there are so many that’s it’s hard to find stuff that you’re looking for sometimes. If you want to tread into the fray, though, check out

  5. sjkeegs

    This is one of the documentation pages that contains a number of demonstration scripts.

    And if you go to the forums, there is a section dedicated to Scripts and Functions

  6. Donald Krebs

    For several years I have been a fan of Donation Coder. One of the most prolific contributors is “Skrommel.” I believe he uses AutoHotKey for all his work. Go here to see several dozen examples of his work.


  7. Randall

    That’s great, but I was expecting to learn how to make scripts, not use premade ones.

  8. Ajith Antony

    Randall, Skrommel has the AHK source linked for each one (the green AHK icons). Just study what they do to make your own.

  9. Jason

    Okay – you’ve finally inspired me to replace disappointing PhraseExpress. No more annoying pop-ups asking for money!

    I, too, would like to see more AHK tutorials…

  10. PhraseExpress

    @Jason: PhraseExpress is completely free for personal use. Only, if you violate the fair-use license by, it will issue the license violation dialog. If you believe that the commercial use detection is not correct, please provide *evidence* and we will send you a free license PLUS licenses for the next 5 commenters – Worth US$ 840!. Are you willing to backup your claim?

  11. Mick

    If anyone’s interested I posted a bunch of my favourite snippets a while back at



  12. Lou B

    You would do your readers a great service if you would show them how to use hot keys for macros.
    Very useful and not too hard. I have more than a dozen which I use regularly.

  13. Jason

    @PhraseExpress – I’ve read your fair use license and it’s crap. Waaay to restrictive for anyone who uses their computer for both home and business use.

  14. PhraseExpress

    So, there is nothing wrong with our commercial use detection. PhraseExpress doesn’t distinguish between full-time and part-time commercial use. You got the license violation warning because you have illegally used PhraseExpress for commercial activities without a valid license. We offer PhraseExpress free for all home users while commercial users finance the many manyears of development we put into PhraseExpress. You probably wouldn’t appreciate as well if you wouldn’t be paid for your work, would you? Please learn more about our fair-use license at

  15. Tux

    One of my most frequent uses of AHK is the hotstrings feature. While this is covered in the tutorial, I will give some examples of the way I use it.

    You can add them to an existing script or create a new one just for your hotstrings.

    The format looks like this:


    in my script file I have the following

    ::lftvm::Called user and left vm requesting a call back.

    After saving the file as hotstrings.ahk and double clicking it, anytime I type ‘lftvm’ it will insert the text ‘Called user and left vm requesting a call back.’

    I have also mixed some hot strings with simple scripts. For instance, if you want to have Ctrl+1 do something like paste frequently used text you can use the following:

    ^1::Send Your Frequently used text

    This is a super simple AHK script, it’s all on oneline, so unlike longer scripts it doesn’t need ‘return’ to terminate it. Step by step this says,When Ctrl+1 (^ is the Ctrl character) is pressed, Send (or type) the following text into the active window.

    A more involved script is the following, which pops up a message box asking if you want to reload your script. You would do this if you are actively adding things to your script and needed to activate the new additions, or if you were having problems with it running.

    ; Reload
    msgbox, 4,, Reload Everyday Script?
    IfMsgBox, No
    IfMsgBox, Yes
    Sleep 1000 ; If successful, the reload will close this instance during the Sleep, so the line below will never be reached.
    MsgBox, 4,, The script could not be reloaded. Would you like to open it for editing?
    IfMsgBox, Yes, Edit

    If you’d like me to step through this one I can.

    Hopefully this is helpful to some.

  16. Ron

    For you gamers…I’ve included a COD4 example script for making a single shot weapon act like a automatic…example uses a 50ms delay factor but set it to the best performing. have fun !!!
    ; ===================================================================
    ; AutoHotKey Script for COD4 Rapid Fire using left mouse button ===
    ; Uses Program Function key F12 – Rapid fire ON or OFF ===
    ; ===================================================================
    IfWinActive, Call of Duty 4
    Click Left
    GetKeyState, LButtonState, LButton, P
    If LButtonState = U
    Sleep, 50

  17. Leroy

    hey dudes, may anybody help me and codes me a small script, which includes that
    the “Q” key on the keyboard is hiten every 4.1 seconds.

    I didn´t find a way to fix that problem…

  18. kyniek


    jak zrobić w AHK żeby pod jednym klawiszem mieć F6 i ctl-v ??? Żeby przy jednym naciścnieniu włączały się.

    Proszę o pomoc.

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!