AutoHotkey Migration: Hotkeys
Mapping AutoHotkey hotkeys and context hotkeys to EyeAuras keybinds, trackers, triggers, and actions.
AutoHotkey Migration: Hotkeys
Use this page for AHK hotkey labels, Hotkey, #HotIf, and simple hotkey
actions. Keyboard state polling and mouse clicks live in
Keyboard And Mouse.
Quick Map
| AutoHotkey Need | AHK APIs | EyeAuras Route | First C# Shape | Judgment | Notes |
|---|---|---|---|---|---|
| Run code from a hotkey | Hotkey labels like ^!s::, Hotkey, #HotIf | [Keybind] methods, IHotkeyTracker with Rx | [Keybind("Ctrl+Alt+S")] void Run() { ... } | [Keybind] is best for simple static hotkeys; tracker/Rx is better for dynamic control. | KeybindAttribute has SuppressKey, IgnoreModifiers, and ActivationType. IHotkeyTracker supports runtime setup and observable composition. Custom AHK combos, ~, *, $, and context-sensitive hotkeys need more mapping. |
Hotkey Sends Text
AutoHotkey v2:
^!s::SendText "hello"
EyeAuras script:
ISendInputScriptingApi SendInput { get; init; }
[Keybind("Ctrl+Alt+S", SuppressKey = true)]
void SendHello()
{
SendInput.Text("hello");
}
Use SuppressKey = false when the original hotkey should still reach the
active application, similar to AHK hotkeys with the ~ prefix.
Tracker/Rx alternative:
ISendInputScriptingApi SendInput { get; init; }
IFactory<IHotkeyTracker> HotkeyTrackerFactory { get; init; }
var tracker = HotkeyTrackerFactory.Create().AddTo(ExecutionAnchors);
tracker.Hotkey = new HotkeyGesture(Key.S, ModifierKeys.Control | ModifierKeys.Alt);
tracker.HotkeyMode = HotkeyMode.Click;
tracker.SuppressKey = true;
tracker.WhenAnyValue(x => x.IsActive)
.Where(x => x)
.SubscribeSafe(_ => SendInput.Text("hello"))
.AddTo(ExecutionAnchors);
The tracker snippet assumes it is placed inside a script that already has a real lifetime, such as a window, loop, hosted service, or larger mini-app. Do not add a fake wait to every sample only to keep the subscription alive.
Recommendation: Good shape. Use [Keybind] for fixed hotkeys; use
IHotkeyTracker with Rx only when the script needs runtime hotkeys or
observable composition.
Verification Links
- AHK docs: Hotkeys, Hotkey, #HotIf, #UseHook.
- AHK source: hotkey.cpp.
- EyeAuras docs: Input, Hooks, Hotkeys, ISendInputScriptingApi, Scripting Runtime.
- EyeAuras source: KeybindAttribute.cs, HotkeyTrackerRuntimeVisitor.cs, IHotkeyTracker.cs, HotkeyTracker.cs, HotkeyGesture.cs, IHotkeyConverter.cs, HotkeyConverter.cs.