Ret Pally AHK Script Request

All, sorry as I am not sure where to put this topic.

My issue is I have clicking so much when my Ret Pally is doing boss fights so I am looking for a AHK script where I can press a button (in my case CTRL+1) to start running a script to spam 1 (which I have bound to my macro from here) and pressing it again to stop running the script. I want it to stay active though where I can hit it again to repeat the process. Anyone have any saved things like this?

Thanks

The script I use. I changed the default keys so you’ll need to change them to suit your needs.


;; by Hadronox / Rezel


;; #################################
;;		INFO
;; #################################

;; The purpose of this macro is to use 3 toggle keys to spam 3 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:  https://autohotkey.com/docs/KeyList.htm

;; PROGRESS WINDOW: https://autohotkey.com/docs/commands/Progress.htm
;; 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 := 30

;; Set the key you want to press to start spam.
KeyToPressA = XButton1		;; MB4

;; Set the key you want AHK to spam.
KeyToSpamA = [


;; ------------------
;;   2nd Toggle Key |
;; ------------------

;; Set your DELAY, in ms.
DelayB := 30

;; Set the key you want to press to start spam.
KeyToPressB = XButton2		;; MB5

;; Set the key you want AHK to spam.
KeyToSpamB = ]


;; ------------------
;;   3rd Toggle Key |
;; ------------------

;; Set your DELAY, in ms.
DelayC := 30

;; Set the key you want to press to start spam.
KeyToPressC = F24		;; FUNCTION 24

;; Set the key you want AHK to spam.
KeyToSpamC = \


;; #################################
;;		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
	SetTimer, SpamKeyB, Off
	SetTimer, SpamKeyC, Off
} Else {
	ToggleA := 1
	ToggleB := 0
	ToggleC := 0
	;; PROGRESS WINDOW - WAS Set as X-400 Y850
	Progress, M B1 X1550 Y850 C1 W75 ZH-5 ZX0 ZY0 FM0 FS20 WM1 WS400 CT40FF06 CW000000, Oak1,,Oak1,Verdana
	SetTimer, SpamKeyB, Off
	SetTimer, SpamKeyC, Off
	SetTimer, SpamKeyA, %DelayA%
}
return

LabelB:
If(ToggleB) {
	ToggleB := 0
	Progress, Off
	SetTimer, SpamKeyA, Off
	SetTimer, SpamKeyB, Off
	SetTimer, SpamKeyC, Off
} Else {
	ToggleB := 1
	ToggleA := 0
	ToggleC := 0
	;; PROGRESS WINDOW - WAS Set as X-400 Y850
	Progress, M B1 X1550 Y850 C1 W75 ZH-5 ZX0 ZY0 FM0 FS20 WM1 WS400 CT40FF06 CW000000, Oak2,,Oak2,Verdana
	SetTimer, SpamKeyA, Off
	SetTimer, SpamKeyC, Off
	SetTimer, SpamKeyB, %DelayB%
}
return

LabelC:
If(ToggleC) {
	ToggleC := 0
	Progress, Off
	SetTimer, SpamKeyA, Off
	SetTimer, SpamKeyB, Off
	SetTimer, SpamKeyC, Off
} Else {
	ToggleC := 1
	ToggleA := 0
	ToggleB := 0
	;; PROGRESS WINDOW - WAS Set as X-400 Y850
	Progress, M B1 X1550 Y850 C1 W75 ZH-5 ZX0 ZY0 FM0 FS20 WM1 WS400 CT40FF06 CW000000, Oak3,,Oak3,Verdana
	SetTimer, SpamKeyA, Off
	SetTimer, SpamKeyB, Off
	SetTimer, SpamKeyC, %DelayC%
}
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


@OAK just wanted to say that your macros are amazing I use them a lot in my paladin and about your script it is really very good I just have a doubt, is there any way instead of me pressing the key once to activate and again to to deactivate it, I can keep it pressed for it to work and when I release the key it stops working? thank you very much for this help o/

Thanks, I’m glad they work well for you. I’m not sure if I can put links in here, but heres to try… I do not know how to script AHK, but this is the dude who made the script I use. He has several on his github, including hold down key versions

https://github.com/SiderealDay/AutoHotKey

Not sure if this helps, but i use this 1 sometimes. This spams the 8 key in this example and F1 starts or stops(pauses) it.

#IfWinActive, World of Warcraft

Pause

SetTimer, Timer1, 100
return

F1::
Pause
return

Timer1:
Send 8
return

@OAK thank you my friend! I found exactly what I wanted in the link you sent, you are the best!

;; by Hadronox / Rezel

;; ########################
;; AUTO EXEC
;; ########################

#NoEnv
SetWorkingDir %A_ScriptDir%
SendMode Event ; default
#SingleInstance Force
#MaxHotkeysPerInterval 20000

;; ########################
;; CONFIG
;; ########################

;; ------------------
;; 1st Hold Key |
;; ------------------

;; Set your DELAY, in ms.
DelayA := 150

;; Set the key you want to hold down to start spam.
KeyToHoldA = 1

;; Set the key you want AHK to spam.
KeyToSpamA = 1

;; ------------------
;; 2nd Hold Key |
;; ------------------

;; Set your DELAY, in ms.
DelayB := 150

;; Set the key you want to hold down to start spam.
KeyToHoldB = 2

;; Set the key you want AHK to spam.
KeyToSpamB = 2

;; ------------------
;; 3rd Hold Key |
;; ------------------

;; Set your DELAY, in ms.
DelayC := 150

;; Set the key you want to hold down to start spam.
KeyToHoldC = 3

;; Set the key you want AHK to spam.
KeyToSpamC = 3

;; ########################
;; MAIN
;; ########################

Hotkey, IfWinActive, World of Warcraft ;; enabled only in WoW
Hotkey, *$%KeyToHoldA%, LabelA
Hotkey, *$%KeyToHoldB%, LabelB
Hotkey, *$%KeyToHoldC%, LabelC
return

LabelA:
SetTimer, SpamKeyA, -1
return

LabelB:
SetTimer, SpamKeyB, -1
return

LabelC:
SetTimer, SpamKeyC, -1
return

SpamKeyA:
While GetKeyState(KeyToHoldA, “P”) {
SetKeyDelay, %DelayA%
Send, {Blind}{%KeyToSpamA%} ;; blind mode to send modifiers
}
return

SpamKeyB:
While GetKeyState(KeyToHoldB, “P”) {
SetKeyDelay, %DelayB%
Send, {Blind}{%KeyToSpamB%} ;; blind mode to send modifiers
}
return

SpamKeyC:
While GetKeyState(KeyToHoldC, “P”) {
SetKeyDelay, %DelayC%
Send, {Blind}{%KeyToSpamC%} ;; blind mode to send modifiers
}
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

Hi,

I have what I needed and wanted to say thanks to everyone fort their help.

#ifWinActive World of Warcraft ;Checks if the World of Warcraft window is opened
#MaxThreadsPerHotkey 2 ;Used to control how many “instances” of a given hotkey or hotstring subroutine are allowed to exist simultaneously

SendTime:= 100 ; Time in milliseconds to repeat key press
$0:: ; Number 0
$^0:: ; Ctrl + 0
$+0:: ; Shift + 0
$!0:: ; Alt + 0
Loop ;Begins the code for looping/repeats
{ ;Begging code structure
if not GetKeyState(“0”, “P”) ;Checks to see if a key is pressed down
break ; Terminates the Loop
if GetKeyState(“Ctrl”, “P”) ;Checks if Ctrl is pressed
Send ^0 ;Sends Ctrl + 0
else if GetKeyState(“Shift”, “P”) ;Checks if Shift is pressed
Send +0 ;Sends Shift + 0
else if GetKeyState(“Alt”, “P”) ;Checks if Alt is pressed
Send !1 ;Sends Alt + 0
else ;Checks if Number 1 is pressed
Send 1 ;Sends Number 1
sleep %SendTime% ;Sends whatever sendTime value is set as
} ;Ending code structure
return

$1::
$^1::
$+1::
$!1::
Loop{
if not GetKeyState(“1”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^1
else if GetKeyState(“Shift”, “P”)
Send +1
else if GetKeyState(“Alt”, “P”)
Send !1
else
Send 1
sleep %SendTime%
}
return

$2::
$^2::
$+2::
$!2::
Loop{
if not GetKeyState(“2”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^2
else if GetKeyState(“Shift”, “P”)
Send +2
else if GetKeyState(“Alt”, “P”)
Send !2
else
Send 2
sleep %SendTime%
}
return

$3::
$^3::
$+3::
$!3::
Loop{
if not GetKeyState(“3”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^3
else if GetKeyState(“Shift”, “P”)
Send +3
else if GetKeyState(“Alt”, “P”)
Send !3
else
Send 3
sleep %SendTime%
}
return

$4::
$^4::
$+4::
$!4::
Loop{
if not GetKeyState(“4”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^4
else if GetKeyState(“Shift”, “P”)
Send +4
else if GetKeyState(“Alt”, “P”)
Send !4
else
Send 4
sleep %SendTime%
}
return

$5::
$^5::
$+5::
$!5::
Loop{
if not GetKeyState(“5”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^5
else if GetKeyState(“Shift”, “P”)
Send +5
else if GetKeyState(“Alt”, “P”)
Send !5
else
Send 5
sleep %SendTime%
}
return

$6::
$^6::
$+6::
$!6::
Loop{
if not GetKeyState(“6”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^6
else if GetKeyState(“Shift”, “P”)
Send +6
else if GetKeyState(“Alt”, “P”)
Send !6
else
Send 6
sleep %SendTime%
}
return

$7::
$^7::
$+7::
$!7::
Loop{
if not GetKeyState(“7”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^7
else if GetKeyState(“Shift”, “P”)
Send +7
else if GetKeyState(“Alt”, “P”)
Send !7
else
Send 7
sleep %SendTime%
}
return

$8::
$^8::
$+8::
$!8::
Loop{
if not GetKeyState(“8”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^8
else if GetKeyState(“Shift”, “P”)
Send +8
else if GetKeyState(“Alt”, “P”)
Send !8
else
Send 8
sleep %SendTime%
}
return

$9::
$^9::
$+9::
$!9::
Loop{
if not GetKeyState(“9”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^9
else if GetKeyState(“Shift”, “P”)
Send +9
else if GetKeyState(“Alt”, “P”)
Send !9
else
Send 9
sleep %SendTime%
}
return

$q::
$^q::
$+q::
$!q::
Loop{
if not GetKeyState(“q”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^q
else if GetKeyState(“Shift”, “P”)
Send +q
else if GetKeyState(“Alt”, “P”)
Send !q
else
Send q
sleep %SendTime%
}
return

$e::
$^e::
$+e::
$!e::
Loop{
if not GetKeyState(“e”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^e
else if GetKeyState(“Shift”, “P”)
Send +e
else if GetKeyState(“Alt”, “P”)
Send !e
else
Send e
sleep %SendTime%
}
return

$r::
$^r::
$+r::
$!r::
Loop{
if not GetKeyState(“r”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^r
else if GetKeyState(“Shift”, “P”)
Send +r
else if GetKeyState(“Alt”, “P”)
Send !r
else
Send r
sleep %SendTime%
}
return

$t::
$^t::
$+t::
$!t::
Loop{
if not GetKeyState(“t”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^t
else if GetKeyState(“Shift”, “P”)
Send +t
else if GetKeyState(“Alt”, “P”)
Send !t
else
Send t
sleep %SendTime%
}
return

$f::
$^f::
$+f::
$!f::
Loop{
if not GetKeyState(“f”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^f
else if GetKeyState(“Shift”, “P”)
Send +f
else if GetKeyState(“Alt”, “P”)
Send !f
else
Send f
sleep %SendTime%
}
return

$g::
$^g::
$+g::
$!g::
Loop{
if not GetKeyState(“g”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^g
else if GetKeyState(“Shift”, “P”)
Send +g
else if GetKeyState(“Alt”, “P”)
Send !g
else
Send g
sleep %SendTime%
}
return

$z::
$^z::
$+z::
$!z::
Loop{
if not GetKeyState(“z”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^z
else if GetKeyState(“Shift”, “P”)
Send +z
else if GetKeyState(“Alt”, “P”)
Send !z
else
Send z
sleep %SendTime%
}
return

$x::
$^x::
$+x::
$!x::
Loop{
if not GetKeyState(“x”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^x
else if GetKeyState(“Shift”, “P”)
Send +x
else if GetKeyState(“Alt”, “P”)
Send !x
else
Send x
sleep %SendTime%
}
return

$c::
$^c::
$+c::
$!c::
Loop{
if not GetKeyState(“c”, “P”)
break
if GetKeyState(“Ctrl”, “P”)
Send ^c
else if GetKeyState(“Shift”, “P”)
Send +c
else if GetKeyState(“Alt”, “P”)
Send !c
else
Send c
sleep %SendTime%
}
return

$v::
$^v::
$+v::
$!v::
Loop{
if not GetKeyState(“v”, “P”)
break
if GetKeyState(“vtrl”, “P”)
Send ^v
else if GetKeyState(“Shift”, “P”)
Send +v
else if GetKeyState(“Alt”, “P”)
Send !v
else
Send v
sleep %SendTime%
}
return

f12::Suspend
^f12::Reload
End::ExitApp

super basic one fires as long as you hold key down put icon in z press q to use

*q::
loop,2
{
send {z}
}