In AutoHotkey v2 every built-in action is called like a function, whether or not you keep a return value. What used to be a comma-separated command line is now a name followed by its arguments.
| Name | Purpose | Example |
|---|---|---|
Send | Type keystrokes | Send "Hello{Enter}" |
SendText | Type literally, ignoring key names | SendText "a^b{c}" |
Click | Mouse click at a position | Click 400, 300 |
MouseMove | Move the pointer | MouseMove 100, 100 |
Hotkey | Create or change a hotkey at runtime | Hotkey "^j", MyAction |
| Name | Purpose | Example |
|---|---|---|
Run | Start a program, file or URL | Run "notepad.exe" |
RunWait | Start it and wait for it to finish | RunWait "cmd /c build.bat" |
WinActivate | Bring a window to the front | WinActivate "ahk_exe notepad.exe" |
WinWait | Pause until a window exists | WinWait "Untitled - Notepad" |
WinMove | Move or resize a window | WinMove 0, 0, 800, 600, "A" |
WinClose | Close a window | WinClose "A" |
| Name | Purpose | Example |
|---|---|---|
MsgBox | Show a dialog | MsgBox "Done" |
ToolTip | Show a small floating note | ToolTip "Working…" |
InputBox | Ask for a value | name := InputBox("Your name?").Value |
Sleep | Wait in milliseconds | Sleep 250 |
SetTimer | Run something on a schedule | SetTimer Check, 5000 |
#Requires AutoHotkey v2.0
^!r::
{
Run "notepad.exe"
WinWait "ahk_exe notepad.exe"
WinActivate "ahk_exe notepad.exe"
Send "Meeting notes{Enter}"
Send FormatTime(A_Now, "MMMM d, yyyy")
}
WinWait is what makes this reliable: without it the keystrokes can arrive before the window is ready.
Arguments in the manual are written in order, with optional ones in square brackets. Anything textual needs quotes; numbers and variables do not. Values that come back — a window title, a clipboard string, a dialog result — are captured with :=.
Reusable logic of your own belongs on the functions page, and complete programs are collected under examples.
Call them like functions: the name followed by arguments, with text in quotes, for example Run "notepad.exe".
Send interprets braces and modifier symbols as keys, while SendText types the string exactly as written.
Follow Run with WinWait, then act on the window once it exists.