AutoHotkey - Getting Started

Published on
195,377 Points
27 Endorsements
Last Modified:
Community Pick
Joe Winograd
50+ years in computer industry •Everything from development to sales •CIO •Windows •Document Imaging •EE MVE 2015,2016,2018 •EE FELLOW 2017
AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to additional resources for EE members who want to learn more.

I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have also answered many questions with a reference to AutoHotkey as a component of the solution. As I was about to write another article with an AutoHotkey program and the how-to-download-and-install paragraph, I decided it would be better to publish a more comprehensive write-up on the process, including some background on the language.

AutoHotkey is a free (in all senses of the word), open source product, published under the GNU GPL (General Public License, Version 2, June 1991). It is a fork of the popular AutoIt language. AutoHotkey started out as a keyboard shortcuts and mouse clicks/movements capability (hence, "Hotkey" in the name), but has been enhanced into a robust programming/scripting language.

AutoHotkey itself has forked several times, with the release at AHKScript.org considered by devotees of the language to be the active/primary branch. Update: Since the initial publication of this article, the ahkscript.org and autohotkey.com domains have been reunited (visiting the former redirects to the latter). If you'd like to learn more about the history of the language, I recommend The AutoHotkey Foundation and Our History pages at its website and the Wikipedia AutoHotkey article.

With a decent computer and Internet connection, the download and installation of AutoHotkey should take less than a minute. At the time of publishing the most recent update to this article, here are the steps:

(1) Visit the AutoHotkey site and click the white-on-green Download button:

(2) This will take you to a download page that shows the current version number and date, with a big white-on-blue button to download the Installer (along with other download options):

(3) Click the Download AutoHotkey Installer button to download the installer (unless you have another need, such as wanting the ZIP file). The exact dialog that you get from this depends on your browser and its settings. For example, you may see something like this:


In any case, run the installer.

(4) If you have UAC on, you will see this:


Sidebar: If you're wondering how I captured the UAC dialog box, see my EE article, How to disable the secure desktop when User Account Control (UAC) prompts for elevation.

(5) If it is a new install, clicking the Yes button on the UAC dialog will give you this:


The recommended Unicode 32-bit is a good choice for new AutoHotkey users.

(6) If you already have AutoHotkey on the system, it will display the installed version and offer to upgrade it, such as this:


Close all running scripts before you click the Upgrade to button, although if you don't, it will warn you:


(7) In a very short period of time (seconds, not minutes), you will see this Installation complete dialog:


That's it! You now have AutoHotkey installed on your computer. It owns the file extension AHK, which is a plain text file with the program in it. You may use whatever text editor you want to create an AHK source code file, even the built-in Notepad (just be sure to save it as a file type of AHK). Since AutoHotkey is associated with AHK files, double-clicking on one in Windows/File Explorer (or whatever file manager you use) will cause AutoHotkey to run that script.

To get started, let's code the classic Hello World program in AutoHotkey. Open up whatever text editor you want and copy/paste this one line of code in it:


MsgBox,0,First AHK script,Hello World

Save the file as HelloWorld.ahk (or whatever you want to call it, as long as the file type is AHK) and then double-click it in your file manager. AutoHotkey will execute it and you'll see this:


You'll likely use the MsgBox command often, so you may want to study its syntax. In fact, all of the AutoHotkey commands are well-documented, with complete syntax and good examples.

A standard installation of AutoHotkey also installs a compiler, which converts an AHK source code file into a stand-alone executable (an EXE file). These EXE files should run on all versions (and bit levels) of Windows going back to Windows 2000. Indeed, I have run these EXE files on W2K, XP/32-bit, Vista/32-bit, W7/32-bit, W7/64-bit, and W8/64-bit. In addition, I just ran the HelloWorld.exe (created on W7) on the W10/64-bit Technical Preview (Build 10061, the latest release at the time of publishing this article) — it worked perfectly:


The easiest way to compile is to right-click on an AHK file in your file manager and select Compile Script from the context menu:


For more compiling options, such as selecting a custom icon or compressing the EXE file, you may run the compiler separately (the installer creates a shortcut to Convert .ahk to .exe in the AutoHotkey Program Group):


Notice in the context menu screenshot above that underneath the Compile Script item is an Edit Script item. This loads the script in whatever text editor you have configured for it. The default is Notepad, but you may change it by modifying this registry key:


For example, to change it to Notepad++ (assuming the standard installation location for it), modify the value of that key to this:

"C:\Program Files\Notepad++\notepad++.exe" "%1"

My purpose in writing this article is to provide an easy, quick, yet comprehensive Getting Started  guide to which I can refer EE members. Going into more detail than presented in this article is not necessary, as there is an excellent and thorough AutoHotkey Beginner Tutorial at the AutoHotkey site.

If you find this article to be helpful, please click the thumbs-up icon below. This lets me know what is valuable for EE members and provides direction for future articles. Thanks very much! Regards, Joe

Ask questions about what you read
If you have a question about something within an article, you can receive help directly from the article author. Experts Exchange article authors are available to answer questions and further the discussion.
Get 7 days free