Seeking an AHK toggle script that only fires one hotkey at a time

Howdy all!
In the past I found an AutoHotKey script which allowed me to toggle spamming 1, 2, and 3. If 1 was running and I hit 2, 1 would stop running, so that only one hotkey would be spamming at any one time. I liked this for switching between ST and AOE etc.
Would anybody have a script like this that I could pinch?
I fear my brain is too small and smooth to figure one out myself, heh.

Hey, did you manage to find an AHK script anywhere or do you still need one?

There are some good ones here that were made by someone in the community: https://github.com/SiderealDay/AutoHotKey/blob/master/README.md

1 Like

Hello,

Thanks for these they are a massive help.

I wonder if I may pick your brain on this as I too and not too smart when it comes to these scripts.

I also suffer from mild Carpal Tunnel so I rely a bit on these to not have to spam buttons too much.

I rn with 3 hunters, just for fun and farming but I have to manually “spam” my buttons to get the key to broadcast across all the WoW windows, in my script it looks like this:

~1::
KeyWait 1
IfWinActive, World of Warcraft
{
ControlSend,, {1}, ahk_id %wowid1%
ControlSend,, {1}, ahk_id %wowid2%
ControlSend,, {1}, ahk_id %wowid3%
ControlSend,, {1}, ahk_id %wowid4%
ControlSend,, {1}, ahk_id %wowid5%
Return
}

I saw and am now using the key hold script and it is amazing when I play on just one hunter, but is it possible to use the key hold across all the WoW windows?

This is what I would really appreciate some help with as I cannot see if it is possible.

For Reference here is the script:

#IfWinActive, World of Warcraft	;; enabled only in WoW

$1::
While GetKeyState("1", "P") {
	Send, {Blind}{1}	;; 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

Those are fantastic, thank you very much for the help!

A problem I’m encountering with the github toggle macros is that, say 1 is currently spamming, I have to hit 2 once to stop spamming 1, and then hit 2 again to start spamming 2. Is there any way I could make hitting 2 once both stop spamming 1 and start spamming 2, and vice versa?

@tachi

If you are using the Toggle_Classic_2Key i think this should do it for you, just replace the 1 & 2 sections in the script with this:

$1::
Toggle1 := !Toggle1
if(Toggle2 = 1){
	Toggle2 = 0
	}
While Toggle1 {
    Send, {Blind}{0}	;; blind mode to send modifiers
    Sleep, 150
}
return

$2::
Toggle2 := !Toggle2
if(Toggle1 = 1){
	Toggle1 = 0
	}
While Toggle2 {
    Send, {Blind}{=}	;; blind mode to send modifiers
    Sleep, 150
}
return

If you are using the Toggle_Modular_2Key replace the Label sections with this:

LabelA:
If (ToggleB = 1){
	ToggleB = 0
}
If(ToggleA) {
	ToggleA := 0
	Progress, Off
	SetTimer, SpamKeyA, Off
	SetTimer, SpamKeyB, 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, SpamKeyB, Off
	SetTimer, SpamKeyA, %DelayA%
}
return

LabelB:
If (ToggleA = 1){
	ToggleA = 0
}
If(ToggleB) {
	ToggleB := 0
	Progress, Off
	SetTimer, SpamKeyA, Off
	SetTimer, SpamKeyB, Off
} Else {
	ToggleB := 1
	;; PROGRESS WINDOW
	Progress, M B1 X1325 Y675 C1 W75 ZH-5 ZX0 ZY0 FM0 FS25 WM1 WS600 CT40FF06 CW000000, ON2,,ON2,Verdana
	SetTimer, SpamKeyA, Off
	SetTimer, SpamKeyB, %DelayB%
}
return

If you are using another could you give me the name or post the script here so I can take a better look?

Hi Tolv, I dont have any experience playing more than one character at a time so im not sure if I can be much help. My AHK knowledge is pretty limited to but ill do my best.

I think it could be done with some combination of what you were using in the past and now, maybe something like:

$1::
While GetKeyState("1", "P") {
    ControlSend,, {1}, ahk_id %wowid1%
    ControlSend,, {1}, ahk_id %wowid2%
    ControlSend,, {1}, ahk_id %wowid3%
    ControlSend,, {1}, ahk_id %wowid4%
    ControlSend,, {1}, ahk_id %wowid5%
    Sleep, 150
}

Im not sure if the {Blind} function works with ControlSend, some documentation states that it doesnt but I have seen posts with people using it. Give this a try to send modifiers such as Shift and Control:

$1::
While GetKeyState("1", "P") {
    ControlSend,, {Blind}1, ahk_id %wowid1%
    ControlSend,, {Blind}1, ahk_id %wowid2%
    ControlSend,, {Blind}1, ahk_id %wowid3%
    ControlSend,, {Blind}1, ahk_id %wowid4%
    ControlSend,, {Blind}1, ahk_id %wowid5%
    Sleep, 150
}

If the {Blind} doesnt work you could try hard coding some modifiers into it, here is a list of key modifiers and what might work.

Key modifiers:
< & > denote if the left or right modifier will be pressed, eg <! is left shift

  • = Shift
    ^ = Ctrl
    ! = Alt
$1::
While GetKeyState("<!1", "P") {
    ControlSend,, {<!1}, ahk_id %wowid1%
    ControlSend,, {<!1}, ahk_id %wowid2%
    ControlSend,, {<!1}, ahk_id %wowid3%
    ControlSend,, {<!1}, ahk_id %wowid4%
    ControlSend,, {<!1}, ahk_id %wowid5%
    Sleep, 150
}

Like I say though I dont know if any of this will actually work its just a guess. If it doesnt I think you would be better off either opening a new thread on the forum or opening one on the AHK forums.

Hi Hippo,

Thank you very much for the detailed description and some possible solutions. I really do appreciate your time.

I’ll give those a try when I get home from work later, otherwise yes, I will open a new thread for it :slight_smile:

Appreciate it and thanks again to you all, these macros and support from you guys and girls are always top-notch.

Have a great day ahead.

Tolv

EDIT:

I tried them and they both didn’t work BUT I decided to change it a bit to match my own script and replaced the “$” with a “~” and now it works really well but sometimes stops working on wowid1, but will tweak it a bit and see.

You’re an absolute legend, thanks for your help, now the wife won’t kill me for spamming my buttons on my keyboard to broadcast. hahaha :smiley:

This is what I used and it works like a charm:

WinGet, wowid, List, World of Warcraft

    ~1::
    While GetKeyState("1", "P") {
        ControlSend,, {1}, ahk_id %wowid1%
        ControlSend,, {1}, ahk_id %wowid2%
        ControlSend,, {1}, ahk_id %wowid3%
        ControlSend,, {1}, ahk_id %wowid4%
        ControlSend,, {1}, ahk_id %wowid5%
        Sleep, 150
    }

That worked perfectly, thank you very much!