Robust AHK script for macro spam and working modifier key insertion (w/monitoring)

I’ve made a number of updates to my key spam macro and wanted to share them with you. the WLM community.

I’ve taken a number of inspirations from various AHK macros, as well as feature requests from my significant other. This script will (optionally) create a non-interactive monitoring display at the top of your screen allowing you to see when your macro is running, as well as pause the script if you leave WoW for another window.


It will robustly handle your modifier keys (please note that some modifier and hotkey combos do not work as expected, particularly Shift+Numpad) and will dynamically update the monitor with the matching symbol of the modifier key you are using (I have used AHK’s mod symbols for brevity, but use the full keyname in the script for better support while spamming your macro key).

Feedback is always appreciated.

; AutoHotkey Version:
; Script Version:		0.4.1
; Language:				English
; Platform:				Win10
; Author:				Drake <>
; Script Function:
;	Easy configure action key spam toggle with robust modifier keys support. Set your
;	activation key, and save. Start the macro by pressing that key, and insert modifiers
;	by holding down any combination of alt, ctrl, and shift. Stop the macro by pressing
;	the activation key again. A non-interactable display in the top-center of your
;	monitor will tell you if the macro is currently active (toggleable).
; 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

;================= User Configurable Values =================
actionkey := "="				; Set the ingame action key or keybind
activationkey := "MButton"		; Set the mouse or keyboard key to start or run the macro
runms := "250"					; Set your preferred macro run time in ms
monitor := true					; Set if monitor display is active
;================= User Configurable Values =================

if (monitor)
	_mvar := ""
if not monitor
	_mvar := "hide "

CustomColor := "EEAA99"  ; Can be any RGB color (it will be made transparent below).
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow  ; +ToolWindow avoids a taskbar button and an alt-tab menu item.
Gui, Color, %CustomColor%
Gui, Font, s12  ; Set a large font size (32-point).
Gui, Add, Text, vMyText cyellow, Macro: InActive`nPress:  %activationkey%`nUsing:  %actionkey%
; Make all pixels of this color transparent and make the text itself translucent (150):
WinSet, TransColor, %CustomColor% 150
Gui, Show

	guiheight := A_guiheight
	guiwidth := A_guiwidth
	gui,show, % _mvar "x" (A_ScreenWidth/2) - (GuiWidth/2) " y0 w" Guiwidth " h" GuiHeight NoActivate

toggle = false

SetTimer, PressKey, %runms%

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


#UseHook Off


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


if not toggle
	GuiControl,, MyText, Macro: InActive`nPress:  %activationkey%`nUsing:  %actionkey%
		if NOT WinActive("World of Warcraft") ; if NOT same window as when this loop started, then…
			WinWaitActive, World of Warcraft ; pause loop here and wait for original window to become Active again

		_keyvar := actionkey
		if StrLen(_keyvar) > 1
			_keyvar := "{" . _keyvar . "}"

		sendkey := "{Blind}"
		_temp := ""

		if GetKeyState("Ctrl", "P")
			sendkey .= "{Ctrl}"
			_temp .= "^"
		if GetKeyState("Shift", "P")
			sendkey .= "{Shift}"
			_temp .= "+"
		if GetKeyState("Alt", "P")
			sendkey .= "{Alt}"
			_temp .= "!"

		GuiControl,, MyText, Macro: Active`nPress:  %activationkey%`nUsing:  %_temp%%actionkey%

		sendkey := sendkey _keyvar

		Send %sendkey%

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.

Updated the macro in the original port. Monitor gui, pause outside of WoW, etc.