Imported from avafyi/ahk (
AGENTS.md). Install upstream withnpx skills add avafyi/ahk. Copyright stays with the author.
Agent Notes for This AutoHotkey Workspace
This repo is a collection of AutoHotkey v2 scripts. Keep edits small and local to the requested game/script, preserve the existing AHK v2 style, and validate syntax before finishing.
Agent Context
- Keep project-specific handoff notes here: script structure, validation commands, local setup, and recurring workflow gotchas.
Main Script
startup/ESDF-remap.ahkis the main startup remap script.- Auto-execute setup must stay before the first hotkey label (
::). Put global variables, timers, and init calls there. - The script's own note is important: for multiple global remaps, the last remap wins; for overlapping
#HotIfsections, the first matching#HotIfsection wins. - Game-specific remaps live under labeled
#HotIf WinActive("ahk_exe ...")blocks. Shared ESDF/game fallback remaps are lower in the file.
Validation and Auto-Reload
startup/ESDF-remap.ahk validates and reloads itself whenever it is saved while the script is already running:
- In the auto-execute section, it records
AutoReloadLastModified := FileGetTime(A_ScriptFullPath, "M")and startsSetTimer ReloadOnSave, 1000. ReloadOnSave()checks the current script file's modified time once per second.- If the modified time changed, it updates
AutoReloadLastModifiedfirst, then runs AutoHotkey validation hidden with:RunWait(Format('"{1}" /ErrorStdOut /validate "{2}"', A_AhkPath, A_ScriptFullPath), , "Hide") - If validation exits with code
0, it callsReload(). - If validation fails, it runs a visible validation command without
/ErrorStdOutso the user can see AutoHotkey's error dialog/window instead of reloading a broken script. A_AhkPathis the interpreter path for the currently running script, so the self-validation uses the same AutoHotkey version that launched it.
When editing from VS Code, still run a direct validation before finalizing if possible. AutoHotkey v2 is permanently available on the user's PATH from:
C:\Program Files\AutoHotkey\v2
Prefer this validation command because it avoids PowerShell's leading call operator (&), which makes command allow rules harder to maintain:
AutoHotkey64.exe /ErrorStdOut /validate "startup\ESDF-remap.ahk"
No output and exit code 0 means the script parsed successfully. If a future shell cannot resolve AutoHotkey64.exe, refresh the environment or open a new terminal before falling back to a full quoted path.