AutoHotkey v2 app icon

System tools

AutoHotkey v2

AutoHotkey v2 is a free GPL-licensed scripting language that turns Windows hotkeys, hotstrings and small dialogs into repeatable automation.

WindowsGPL-2.0-only

AutoHotkey v2 overview: scripting Windows input and desktop tasks

What AutoHotkey v2 is

AutoHotkey is a small scripting language built around one idea: if you can describe a repetitive action on a Windows desktop, you can automate it in a text file. Version 2 is the current generation of the language and uses an expression-based syntax with objects, arrays, maps, classes, functions and structured error handling. A script can bind keystrokes to actions, expand typed abbreviations into longer text, drive windows and controls, send simulated input, read pixels or search the screen for an image, and build simple GUIs. Scripts live in plain .ahk files, need no project setup and can be kept running in the notification area.

How a typical script is built

The usual workflow starts with a hotkey label such as a modifier plus a letter, followed by the statements to run. From there the language scales in steps: hotstrings replace typed text, directives let you restrict a hotkey to particular windows or conditions, and functions and classes keep larger scripts readable. For window work, commands that activate, move, resize or wait for a window handle most cases; for applications that ignore simulated keys, control-level messages and UI Automation access are the fallback. When a script is finished it can either be launched directly by the interpreter or compiled into a standalone executable with the optional compiler that ships with the installer.

Settings, syntax and practical limits

AutoHotkey is Windows-only. The v2 installer can coexist with older v1 installations through a launcher, but v1 syntax is not compatible with v2, so existing scripts need porting before they run here. Timing behaviour is controlled by send modes and key or window delays, which matter in slower applications; simulated input is blocked from reaching windows that run elevated unless the script itself runs elevated, and some games with aggressive input handling reject synthetic keystrokes entirely. Debugging relies on the bundled window spy and the script's own message output, since there is no first-party full IDE.

When to choose something else

If you want a graphical macro recorder that repeats mouse and keyboard gestures without writing code, a recorder is a faster start. If your automation must run on macOS or Linux as well, this language will not help, and a cross-platform scripting runtime is the better investment. For scheduled unattended jobs on a server, native task scheduling plus a shell or Python script is usually more robust. AutoHotkey is at its best for interactive desktop quality-of-life automation on Windows.

Best for
Windows users who want to automate keypresses, text expansion and small desktop workflows with a script they fully control.
Good to know
Version 2 syntax is not backward compatible with v1 scripts, so older code needs porting; the installer can keep both versions side by side.

How to get started

  1. Download the setup executable and run it; choose the default install unless you need a custom location.
  2. Create a new file with the .ahk extension, for example MyKeys.ahk, and open it in a plain text editor.
  3. Add a hotkey such as #n::Run "notepad.exe", save the file, then double-click it to run the script.
  4. Watch the tray icon to confirm the script is loaded, and use the bundled window spy to check window titles for your conditions.
  5. Right-click the tray icon and choose Exit when you want to stop the script, and add it to the startup folder if it should always run.

Questions & answers

Do v1 scripts work in version 2?

No. Version 2 changed to expression syntax, so older scripts must be ported. The launcher allows v1 and v2 to be installed together, which keeps migration gradual.

Can I share a script with someone who has not installed AutoHotkey?

Yes, if you compile it with the optional compiler. Otherwise the recipient needs the interpreter installed to run the .ahk file.

Why does a hotkey do nothing in one application?

Elevated windows ignore input from a non-elevated script, and some games block simulated keystrokes. Run the script as administrator or use control-level commands where supported.

More in system tools

View category
AutoHotkey v2 Free Download - Windows Automation Scripts