comments

; This is a comment

/* This is also a comment */ …but the comment does not end here.

escapes

  • ``"` escapes a quote
  • ``t` tab
  • ``n` linefeed
  • ``r` carriage return

variables

assignment

MyVar := "Some text"

"The value is " MyVar ; this will be implicitly concatenated

format function

To format strings:

MsgBox Format("You are using AutoHotkey v{1} {2}-bit.", A_AhkVersion, A_PtrSize*8)

operators

ternary

condition ? valueIfTrue : valueIfFalse

functions

Parentheses can be omitted if a function call is a single line:

MsgBox "This doesn't need parantheses."

GetKeyState("Shift") ; returns 1 if true

optional parameters

Run "notepad.exe", "C:\
Run "notepad.exe",, "Min" ; the delimiting comma is needed to make "Min" the 3rd argument
Run("notepad.exe", , , &notepadPID)