What Scripting Language Does AHK Use?


Larry Thompson

In the world of automation and productivity, AutoHotkey (AHK) is a popular scripting language that allows users to create custom hotkeys, macros, and automation scripts for Windows. If you are new to AHK, you might be curious about what scripting language it uses.

The Scripting Language of AutoHotkey

AutoHotkey uses its own scripting language, which is specifically designed for automating tasks in Windows. The syntax of this scripting language is based on the Basic programming language.

Why Choose a Custom Scripting Language?

AutoHotkey’s creators developed their own scripting language to provide users with a simple and beginner-friendly way to automate tasks on Windows. By creating a custom scripting language, AutoHotkey offers a more accessible alternative to complex programming languages like C++ or Java.

The Syntax of AHK’s Scripting Language

The AHK scripting language uses plain text files with the extension “.ahk”. These files contain lines of code that are executed by the AutoHotkey interpreter. Let’s take a look at some essential elements of AHK’s syntax:

1. Hotkeys and Hotstrings

One of the key features of AutoHotkey is its ability to create custom hotkeys. These hotkeys allow you to trigger actions or scripts with specific key combinations. For example:

MsgBox "Hello World!"

In this example, pressing Ctrl+Shift+C will display a message box with the text “Hello World!”. The :: symbol denotes the start and end of the hotkey definition, and return indicates the end of the hotkey block.

Hotstrings, on the other hand, allow you to replace a specific string with another. For instance:

Send "by the way"

In this example, typing “btw” followed by a space or punctuation will automatically be replaced with “by the way”. This can save you time and effort when typing frequently used phrases.

2. Variables and Expressions

Variables in AutoHotkey are denoted by the % symbol. You can assign values to variables and use them throughout your script. For example:

x := 10
y := x * 2
MsgBox %y%

In this code snippet, we assign the value 10 to the variable x, then multiply it by 2 and store the result in y. Finally, we display a message box with the value of y.

3. Functions and Control Structures

AHK’s scripting language supports various built-in functions and control structures. These allow you to perform conditional operations, loops, and execute specific actions based on certain conditions. Here’s an example using an if statement:

x := 5
if (x > 0) {
    MsgBox "x is positive"

In this case, if x > 0, AHK will display a message box with the text “x is positive”. Control structures like loops (e.g., while, for) and branches (e., else, switch) provide further flexibility in your scripts.


The scripting language used by AutoHotkey is specifically designed to provide an accessible and user-friendly platform for automating tasks in Windows. By using its own scripting language, AHK simplifies the process of creating hotkeys, macros, and automation scripts for both novice and experienced users. With a basic understanding of AHK’s syntax and a little experimentation, you’ll be well on your way to automating your Windows workflow!