In AutoHotkey v2, there are several built-in functions that can be used to handle specific events or conditions. These are often referred to as “event handlers” or “callback functions.” Here are some of the key ones:
- OnError: Runs when an unhandled error occurs in the script.
- OnExit: Runs when the script is about to exit.
- OnClipboardChange: Runs when the contents of the clipboard change.
- OnMessage: Runs when the script receives a specific Windows message.
- SetTimer: While not exactly an event handler, it allows you to run a function at specified intervals or when a condition is met.
- Gui.OnEvent(): Sets up event handlers for GUI controls (like buttons, edit fields, etc.).
These functions allow you to create more responsive and dynamic scripts by reacting to various system or user-initiated events

