Association of Personal Computer User Groups

Arizona Alliance of Computer Clubs


AutoHotKey FAQ
Getting Started
by Hank Pearson
What is AutoHotKey?
AutoHotKey is a handy scripting language for developing useful tools in Windows
Where is this FAQ (Frequently Asked Questions) on the web?
Where do I get AutoHotKey?
Go to, download the program, and install it
How much does AutoHotKey cost?
AutoHotKey is free, and you can even change the source code if you know how
How do I learn AutoHotKey?
A help file with examples is installed with AutoHotKey, but Google's your friend (

Just search for AutoHotKey Documentation to get started

Then search for more specific topics as you learn
Why not search from within the AutoHotKey site?
The Google search is often better than the search on individual sites
How do I restrict Google to search only within a site?
To search within a site, use the Google site: operator as in this example: custom combination keys
How do I create a script file?
In Explorer (Windows Explorer), in the folder where you want to store your script, right-click an open area, choose New, and then AutoHotKey Script

Name it as desired, keeping the .ahk extension, and press Enter
Is there a quick way to open the Explorer file manager?
Yes - press Win+E
Where is the Win key?
The Windows key is typically next to the Alt key
Why not just create a text file with the extension .ahk?
You can - the script file is plain text

But using the New, AutoHotKey Script option creates a template with a couple of standard commands
Are the template commands required?
No, but they speed up your script
How do I edit a script file?
Right-click the file name (in Explorer) and choose Edit Script
What program should I use to edit scripts?
Use any text editor (such as Notepad or Notepad++)
Are there other standard commands to add to my template or script?
Yes, near the top, type
    #SingleInstance force

This command replaces your script in memory each time you run it as you change and test
How do I run a script?
Just double-click the file name, or select it and press Enter (like any other program)
Can I legally share my scripts?
Yes, there are no royalties or limitations involved
Do my friends need to install AutoHotKey to use my scripts?
No, you can compile your scripts to create .exe (executable) files to share
How do I create .exe script files?
Right click your .ahk script file and click Compile Script
How do I write comments in an AutoHotKey script?
Single-line comments begin with semicolons (;)
Multi-line comments are enclosed in /* and */
How are long lines continued to the next line?
Very easily - see Splitting a Long Line:
Can hotkeys perform different actions depending on the active or existing window?
Yes, hotkeys can be context-sensitive:
How can any two keys be used as hotkeys (without using Ctrl, Alt, Shift, and Win)?
See the custom combination examples:
How do I create windows, controls, menus, and forms?
Get your feet wet with simple hotkeys and hotstrings. Then see the GUI documentation:
Can I write my own functions?
With ease. See the Function docs:
Can commands be used as functions?
Yes, see functions.ahk:
Is there plenty of support for AutoHotKey?
Yes, in addition to the documentation, there are thousands of AutoHotKey articles and a community forum:
What does a sample script look like?
    AutoHotKey script

SendMode Input
#SingleInstance force

MsgBox, , Practice,
    Edit notes.txt

    Purple Mountain Majesty

    insert timestamp

    roll mouse wheel

; Win+Slash edits notes.txt

#/::run %A_MyDocuments%\notes.txt

    typed in any text application
    is replaced with
    Purple Mountain Majesty

::pmm::Purple Mountain Majesty

    Pressing Win+Down or Win+Up
    rolls the mouse wheel

#Down::Send {WheelDown}
#Up::Send {WheelUp}

    Win+T inserts a timestamp
    formatted as you like, such as
    2007-01-09 Tue 19:35

    FormatTime, TimeString,
    , yyyyy-MM-dd ddd HH:mm
    Send %TimeString%

; end Practice.ahk
AutoHotKey provides an enjoyable framework for creating tools to make your computing more interesting and productive.

Related article:

The Fun of Creating Tools
An Introduction to AutoHotKey
by Hank Pearson

Shows how easy it really is to create tools to make your computing more interesting and productive. Includes useful examples and discusses the benefit of writing informal notes before writing code.