Let users add their own Triggers (Hotkey, HotString, or Mouse click) with Our AutoHotkey v2 Preferences Library

Transform how you manage hotkeys, hotstrings, and tray menus in AutoHotkey v2 with our powerful Preferences Library / Triggers Class! This specialized library makes it easy to configure, store, and retrieve hotkey and hotstring settings, while also providing a dynamic tray menu to display the actions tied to each. Perfect for creating user-friendly, customizable scripts, this library simplifies complex input management and enhances script accessibility.

Updated on 2026/06/02 to Version: 0.4.0

Key Features

  • Hotkey & Hotstring Management: Easily define, modify, and store hotkeys and hotstrings for your scripts.

  • Dynamic Tray Menu: Automatically generates a system tray menu that reveals the action tied to each hotkey or hotstring.

  • User-Friendly Configuration: Intuitive interface for setting and updating preferences without complex coding.

  • Persistent Settings: Save configurations to INI

  • Lightweight and Efficient: Optimized for AutoHotkey v2, ensuring minimal impact on script performance.

Tips on Working with our AHK v2 Triggers Class

Tips on Working with our AHK v2 Triggers Class


Discussing Changes to our Triggers Class

Discussing Changes to our Triggers Class


Triggers Class for AutoHotkey v2

Let Your Users Choose Their Own Hotkeys — Without You Writing a Single Extra GUI

Stop hardcoding hotkeys. Start empowering your users.

The Triggers Class is a drop-in AutoHotkey v2 library that gives your scripts a fully-built, professional Preferences UI — letting end-users customize their own hotkeys, mouse shortcuts, and hotstrings at runtime. No GUI coding required on your part.

What It Does

You write your functions. Triggers handles the rest.

With just a few lines of code, the Triggers Class automatically generates a clean Preferences window where users can assign and reassign keyboard hotkeys, mouse button combinations, and hotstrings to any function in your script. Every change is saved to an INI file and restored on next launch — zero effort from you.

Why Developers Love It

  • One line per trigger — Call Triggers.AddHotkey(), Triggers.AddMouse(), or Triggers.AddHotstring() and point it at your function. Done.
  • Full Preferences GUI auto-generated — A polished settings window with grouped controls, dropdown selectors, and Apply/Cancel buttons appears automatically. You never touch Gui.Add().
  • Three trigger types in one system — Keyboard hotkeys, mouse buttons (with modifier key combos), and hotstrings all managed through one unified interface.
  • Window-aware context filtering — Users can scope any trigger to a specific window using the built-in crosshair picker. Click, drag, and drop on any window to auto-capture its title. Triggers only fire when that window is active.
  • Persistent settings — All user preferences save to a settings.ini and reload automatically on script start. Users configure once and forget.
  • Smart tray menu integration — Every trigger is listed in the system tray with its current shortcut displayed. Optionally make triggers callable directly from the tray menu.
  • Duplicate detection — The class prevents users from accidentally assigning the same hotkey to multiple actions within the same context.
  • Disable individual triggers — Users can turn off any trigger from the dropdown without losing its saved configuration.
  • Static class design — No instantiation needed. Just #Include it and start calling methods.

That’s it. Your users now have a full preferences panel to customize every trigger exactly how they want.

How It Works (User Side)

  1. Right-click the tray icon → open Preferences
  2. Pick a trigger → choose Mouse, Keyboard, HotString, or Disable from the dropdown
  3. Set modifier keys (Win, Ctrl, Shift, Alt) and the trigger key
  4. Optionally use the crosshair tool to target a specific window
  5. Click Save — done. Triggers are live immediately and remembered for next time.

Key Features at a Glance

FeatureDetails
Trigger TypesKeyboard hotkeys, mouse buttons, hotstrings
Modifier KeysWin, Ctrl, Shift, Alt (any combination)
Context FilteringPer-trigger window targeting with drag-and-drop crosshair picker
PersistenceAuto-save/load via INI file
Tray IntegrationAuto-built tray menu with shortcut labels
Duplicate PreventionWarns users if a hotkey is already assigned
Disable/EnablePer-trigger disable without losing configuration
Parent GUI SupportAttach Preferences as an owned child of your main GUI
Checkbox GroupsAdd grouped checkbox options for additional settings (beta)

Requirements

  • AutoHotkey v2.0+
  • Licensed under CC BY 4.0

Who Is This For?

  • Script developers who distribute tools and want users to customize their own shortcuts
  • Power users building personal automation who want an easy way to manage and change triggers on the fly
  • Anyone tired of editing script source code just to change a hotkey

One include. A few method calls. A fully professional preferences system for your users.

Comments are closed.