This page is the short version: enough of the language to read someone else's script and write your own, with links to local reference articles and related guides in the menu.
A script is a plain text file. Lines run from top to bottom when it loads, and any hotkey definitions stay resident, waiting for their key.
#Requires AutoHotkey v2.0
count := 0
^!c::
{
global count
count += 1
MsgBox "Pressed " count " time(s)"
}
Assign with :=. Text goes in double quotes; numbers do not. Joining values together is done by placing them next to each other, as in the message box above.
name := "Ada" year := 1843 line := name " published in " year
if (year > 1800)
MsgBox "Nineteenth century or later"
else
MsgBox "Earlier than that"
loop 3
Send "{Tab}"
An array holds an ordered list; a map holds named entries. Both are created with a literal and read with square brackets.
tools := ["editor", "terminal", "browser"]
paths := Map("home", "C:\Users", "temp", "C:\Temp")
for item in tools
MsgBox item
MsgBox paths["temp"]
MyGui := Gui()
MyGui.Add("Text",, "What should I call you?")
MyGui.Add("Edit", "w180 vName")
MyGui.Add("Button",, "OK").OnEvent("Click", Greet)
MyGui.Show()
Greet(*)
{
saved := MyGui.Submit()
MsgBox "Hello, " saved.Name
}
Version covered: AutoHotkey v2.0. Scripts written for the older 1.1 series need adjusting before they run here.