I have used:
==========================================================
;; by Hadronox / Rezel
#MaxThreadsPerHotkey 2
#IfWinActive World of Warcraft ;; enabled only in WoW
Toggle1 := 0
Toggle2 := 0
$1::
Toggle1 := !Toggle1
While Toggle1 {
Send, {Blind}{1} ;; blind mode to send modifiers
Sleep, 150
}
return
$2::
Toggle2 := !Toggle2
While Toggle2 {
Send, {Blind}{2} ;; blind mode to send modifiers
Sleep, 150
}
return
#IfWinActive ;; disable WoW context sensitivity
^PgDn::Suspend ;; Ctrl + PageDown to suspend script (if you want to chat)
^PgUp::Reload ;; Ctrl + PageUP to reload script
^End::ExitApp ;; Ctrl + End to terminate script
But currently use:
======================================================
;; by Hadronox / Rezel
;; ############################
;; INFO
;; ############################
;; The purpose of this macro is to use 2 toggle keys to spam 2 other keys.
;; Default: “Mouse Button 4” will spam “1” at 150ms, and “Mouse Button 5” will spam “2” at 150ms.
;; All keys are customizable along with the delays in the CONFIG section.
;; for a list of AHK Keys: List of Keys (Keyboard, Mouse and Joystick) | AutoHotkey
;; PROGRESS WINDOW: Progress / SplashImage - Syntax & Usage | AutoHotkey
;; Progress, M B1 X1325 Y675 C1 W75 ZH-5 ZX0 ZY0 FM0 FS25 WM1 WS600 CT40FF06 CW000000, ON1,ON1,Verdana
; M: movable window / B: No border / B1: thin border, no title bar / B2: thick border.
; Xn/Yn coord upper left corner / Cxy: centered sub/main text / Wn: width client area.
; ZHn: window height/thickness / ZXn: left/right margin / ZYn: top/bottom margin.
; FMn: main font size, 0=10 / FSn: sub font size, 0=8.
; WMn: main font weight / WSn: sub font weight, 1-1000, 600=semi bold, 700=bold, 400=normal.
; CTn: color text / CWn: color background, 16 primary HTML color names or a 6-digit RGB hex.
;; #################################
;; AUTO EXEC
;; #################################
#NoEnv
SetWorkingDir %A_ScriptDir%
SendMode Input
#SingleInstance Force
#MaxThreadsPerHotkey 2
;; #################################
;; CONFIG
;; #################################
;; ------------------
;; 1st Toggle Key |
;; ------------------
;; Set your DELAY, in ms.
DelayA := 100
;; Set the key you want to press to start spam.
KeyToPressA = 1 ;; MB4
;; Set the key you want AHK to spam.
KeyToSpamA = 1
;; ------------------
;; 2nd Toggle Key |
;; ------------------
;; Set your DELAY, in ms.
DelayB := 100
;; Set the key you want to press to start spam.
KeyToPressB = 2 ;; MB5
;; Set the key you want AHK to spam.
KeyToSpamB = 2
;; ------------------
;; 3rd Toggle Key |
;; ------------------
;; Set your DELAY, in ms.
DelayC := 150
;; Set the key you want to press to start spam.
KeyToPressC = 3
;; Set the key you want AHK to spam.
KeyToSpamC = 3
;; #################################
;; MAIN
;; #################################
; Hotkey, IfWinActive, World of Warcraft ;; enabled only in WoW
Hotkey, $%KeyToPressA%, LabelA
Hotkey, $%KeyToPressB%, LabelB
Hotkey, $%KeyToPressC%, LabelC
return
ToggleA := 0
ToggleB := 0
ToggleC := 0
LabelA:
If(ToggleA) {
ToggleA := 0
Progress, Off
SetTimer, SpamKeyA, Off
} Else {
ToggleA := 1
;; PROGRESS WINDOW
Progress, M B1 X1325 Y675 C1 W75 ZH-5 ZX0 ZY0 FM0 FS25 WM1 WS600 CT40FF06 CW000000, ON1,ON1,Verdana
SetTimer, SpamKeyA, %DelayA%
}
return
LabelB:
If(ToggleB) {
ToggleB := 0
Progress, Off
SetTimer, SpamKeyB, Off
} Else {
ToggleB := 1
;; PROGRESS WINDOW
Progress, M B1 X1325 Y712 C1 W75 ZH-5 ZX0 ZY0 FM0 FS25 WM1 WS600 CT40FF06 CW000000, ON2,ON2,Verdana
SetTimer, SpamKeyB, %DelayB%
}
return
LabelC:
If(ToggleC) {
ToggleC := 0
Progress, Off
SetTimer, SpamKeyC, Off
} Else {
ToggleC := 1
;; PROGRESS WINDOW
Progress, M B1 X1325 Y747 C1 W75 ZH-5 ZX0 ZY0 FM0 FS25 WM1 WS600 CT40FF06 CW000000, ON3,ON3,Verdana
SetTimer, SpamKeyC, %DelayB%
}
return
;; blind mode to send modifiers
SpamKeyA:
Send, {Blind}{%KeyToSpamA%}
return
SpamKeyB:
Send, {Blind}{%KeyToSpamB%}
return
SpamKeyC:
Send, {Blind}{%KeyToSpamC%}
return
;; #################################
;; CONTROLS
;; #################################
^PgDn::Suspend ;; Ctrl + PageDown to suspend script (if you want to chat)
^PgUp::Reload ;; Ctrl + PageUP to reload script
^End::ExitApp ;; Ctrl + End to terminate script
=====================================================
Looks complicated but is easy to use, timings are easy to set.