Robust AHK script for macro spam and working modifier key insertion

Greetings, I’ve just started to dig into Lazy Macros and the GSE community after struggling to catch up on 7 or 8 years of game play changes across the various classes I enjoyed playing.

Having been experienced in AHK scripting, and seeing a need to have something universal that “just works”, I figured I’d take a day to look through what was here already and flesh it all out into something that others might find useful.

Use it or don’t, I understand either way.

; AutoHotkey Version:
; Script Version:		0.2.0
; Language:				English
; Platform:				Win10
; Author:				Drake <>
; Script Function:
;	Easy configure hotkey spam toggle with robust modifier keys support. Set your hotkey,
;	and save. Start the spam macro by pressing that key, and insert modifiers by holding
;	down any combination of alt, ctrl, and shift.
; Of Note:
;	Testing in-game found that wow does not recognize the difference between left and
;	right modifier keys in their macros. That still leaves 8 total combinations when you
;	include [nomod].
; Additionally:
;	Some modifier and hotkey combos do not work as expected. Particularly Shift+Numpad or letters
; Please make sure you are running the lastest version of AutoHotKey <>

#NoEnv                       ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input               ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#MaxThreadsPerHotkey 3

#ifWinActive World of Warcraft ; Only run if window "World of Warcraft" is active

var := "1"					; Set your preferred hotkey here
runms := "250"				; Set your preferred macro run time in ms

toggle = false

SetTimer, PressKey, %runms%

#UseHook On					; do not allow AHK to trigger these hotkeys with Send

HotKey,!^+%var%,DoToggle	; alt+control+shift+key
HotKey,+^%var%,DoToggle		; shift+control+key
HotKey,!^%var%,DoToggle		; alt+control+key
HotKey,!+%var%,DoToggle		; alt+shift+key
HotKey,^%var%,DoToggle		; control+key
HotKey,+%var%,DoToggle		; shift+key
HotKey,!%var%,DoToggle		; alt+key
HotKey,%var%,DoToggle		; no modifier

#UseHook Off


If (toggle := !toggle)		; toggle on/off spamming hotkey
		Gosub PressKey


If toggle
		if GetKeyState("Alt", "P") && GetKeyState("Ctrl", "P") && GetKeyState("Shift","P")
			Send {Blind}!^{Shift}{%var%}				; If alt, control, and shift is pressed then send alt+control+shift+key
		else if GetKeyState("Shift", "P") && GetKeyState("Ctrl", "P")
			Send {Blind}{Shift}^{%var%}					; blind avoids releasing mod keys
		else if GetKeyState("Alt", "P") && GetKeyState("Ctrl", "P")
			Send {Blind}!^{%var%}					; continue the logic
		else if GetKeyState("Alt", "P") && GetKeyState("Shift", "P")
			Send {Blind}!{Shift}{%var%}
		else if GetKeyState("Ctrl", "P")
			Send {Blind}^{%var%}
		else if GetKeyState("Shift", "P")
			Send {Blind}{Shift}{%var%}
		else if GetKeyState("Alt", "P")
			Send {Blind}!{%var%}
			Send {Blind}{%var%}

Minor update to reliably send the shift key modifier instead of possibly changing the keypress into the Shifted form (shift+1 vs !, or shift+a vs A).

Tested in wow and works.

This will break a lot of GSE’s timing functions that depend on this being a constant number. Also Blizzard knows your using AHK via Warden so the argument that you will appear more human is a farce.


I might simplify this a bit then, old habit. Thanks for the feedback!

I already want to make the repeat loop optional, plus trying to work in more hotkey options (trying to set Numpad key as your variable doesn’t work at the moment, need some time to experiment).

  1. Simplified keypress delay, now defined the same way hotkey is.
  2. Expanded safe hotkeys.
  • Please note, shift+letter and shift+numpad# do not play well with wow keybinds. Consider this when personalizing your macros.