user@s3-3:~/s3-3/tools/how-to-use-autohotkey-basics $ cat index.md
S3-3 Tech Guides & Tools
~/tools/how-to-use-autohotkey-basics
Productivity Tools · Jun 2026

How to Use AutoHotkey: Automation Scripts for Everyday Windows Tasks

AutoHotkey (autohotkey.com) is a free, open-source automation tool for Windows that lets you write simple scripts to automate repetitive tasks — remapping keyboard keys, expanding short text snippets into full phrases, clicking through repeated dialog boxes, or launching apps with a single keypress. It has been around since 2003, has a large community, and has a script syntax that non-programmers can learn in an afternoon for basic tasks.

This guide covers AutoHotkey v2, the current major version, which introduced cleaner syntax than v1. Scripts written for v1 will not run in v2 without changes — if you find older scripts online and they do not work, that is usually why.

Step 1: Install AutoHotkey

  1. Download AutoHotkey from autohotkey.com. Choose the installer for v2.
  2. Run the installer and accept the defaults. The installer adds AutoHotkey to the right-click menu so you can create new scripts from File Explorer.

Step 2: Create Your First Script

  1. Right-click on your Desktop, select New → AutoHotkey Script. Name it something like my_shortcuts.ahk.
  2. Right-click the new file and choose Edit with Notepad (or any text editor).
  3. The file starts with #Requires AutoHotkey v2.0. Below this line, add your hotkeys.
  4. Double-click the script file to run it. A green H icon appears in the system tray to show it is active.

Essential Syntax

AutoHotkey scripts use a straightforward syntax. Here are the building blocks:

Hotkeys — Trigger on Keypress

A hotkey line follows the pattern Modifier+Key:: followed by what to do.

; Win+N opens Notepad
#n::Run "notepad.exe"

; Ctrl+Alt+C copies and clears clipboard
^!c:: {
    A_Clipboard := ""
    Send "^c"
}

; F5 types today's date
F5::Send FormatTime(, "yyyy-MM-dd")

Modifier symbols: # = Win key, ^ = Ctrl, ! = Alt, + = Shift. Lines starting with ; are comments.

Hotstrings — Text Expansion

Type a short abbreviation and AutoHotkey replaces it with the full text. This is one of the most immediately useful features:

::addr::123 Main Street, Springfield, IL 62701
::sig::Best regards,{Enter}Your Name{Enter}[email protected]
::shrug::¯\_(?)_/¯
::btw::by the way

Type addr followed by a space or punctuation and it expands to the full address. The {Enter} inserts a newline.

Running Programs

; Ctrl+Shift+E opens File Explorer to a specific folder
^+e::Run "explorer.exe C:\Projects"

; Win+B opens the browser
#b::Run "chrome.exe"

Practical Scripts for Everyday Use

Remap Caps Lock to Escape

A popular remapping, especially for people who use Vim or find Caps Lock useless:

CapsLock::Escape

Quick Window Management

; Win+Left/Right/Up arrows move windows (supplements built-in snapping)
#Left::WinMove(0, 0, A_ScreenWidth/2, A_ScreenHeight, "A")
#Right::WinMove(A_ScreenWidth/2, 0, A_ScreenWidth/2, A_ScreenHeight, "A")

Mute / Unmute Microphone on a Hotkey

; F4 toggles microphone mute
F4::SoundSetMute -1, , "capture"

Making a Script Run at Startup

  1. Press Win+R, type shell:startup, press Enter. The Startup folder opens in File Explorer.
  2. Create a shortcut to your .ahk script file and place the shortcut in this folder. The script will run automatically each time you log in.

Editing and Reloading

Right-click the H icon in the system tray and choose Reload Script after making changes. You do not need to close and reopen — reload applies the new version immediately. Choose Exit to stop the script entirely.

When AutoHotkey Is Overkill

Windows has built-in text expansion through PowerToys (the Text Expander module) and through keyboard shortcut settings in individual apps. For simple text snippets with no logic, those are easier to set up. AutoHotkey becomes worth it when you need conditional logic, loops, interacting with specific window titles, or doing things that built-in tools cannot — like scraping text from a specific app or automating form inputs across multiple programs.

Start with a small script for the two or three repetitive tasks you do most often. AutoHotkey compounds over time — each script you add reclaims a few seconds from your day across hundreds of repetitions per week.