New AHK script for those running ST and AOE + diffrent delay without tabbing out to change in notepad

Hello there. I’ve dabbed alot in AHK scripting to improve the ones out there.
So far I’ve made 1 that is out here and toggles on and off with a simple click of F9 or F10.
Then I had a day I was testing diffrent macro’s and noticed they run at diffrent speeds and often you need to modify and test the speeds yourself to make it work optimal for you aswell.
I then figured “What if I add a promt window to change the delay while still ingame, not having to open AHK to edit it and reload it before trying again”.
Thats exactly what I did!
So here is the new AHK script from me that auto reloads when you make changes to the speed without having to tab out of wow and edit in a notepad or something.

I’ll be adding 2 diffrent ones as 1 uses F9 to toggle on/off and the other uses F10 to toggle on/off.
Why 2? Many macro authors have 1 macro for Single Target and AoE.

This one is keybind Q as that is what I use, but as you see that is a simple swap in notepad as I added a easy way to swap it at the top. Just change the keybind : = “q” to your wanted keybind. So if you want it at 1 you change the q to a 1 so it looks like this : keybind : = “1”

; Set the toggle variable to off
toggle := 0
keybind := "q"
delay := 200

; Set the send mode to input (may not be necessary depending on your system)
SendMode Input

; Define the function to send the keystroke
SendKey:
    IfWinActive, World of Warcraft
    {
        Loop {
            if not GetKeyState(keybind, "P") {
                break
            }
            if GetKeyState("LCtrl", "P") {
                SendInput ^{%keybind%}
            } else if GetKeyState("LShift", "P") {
                SendInput +{%keybind%}
            } else if GetKeyState("LAlt", "P") {
                SendInput !{%keybind%}
            } else {
                SendInput {%keybind%}
            }
            sleep delay
        }
    }
return

#IfWinActive, World of Warcraft ; Only run if window 'World of Warcraft' is active

; Hotkey to toggle the script
$F9::
    toggle := !toggle
    if (toggle) {
        SetTimer, SendKey, %delay%
    } else {
        SetTimer, SendKey, Off
    }
return

; Hotkey to change delay
$F11::
    InputBox, newDelay, Delay, Enter new delay in ms (min: 50ms),  , 200, 100, , , %delay%
    if (newDelay >= 50) {
        delay := newDelay
        Tooltip, Delay set to: %delay% ms
        SetTimer, RemoveTooltip, -2000
    }
return

#IfWinActive

; If World of Warcraft is not running, turn off the script
#IfWinNotExist, World of Warcraft
    SetTimer, SendKey, Off
    toggle := 0
#IfWinActive

; Function to remove tooltip
RemoveTooltip:
    Tooltip
return

This one is for E with toggle F10 on/off and F12 Prompting a delay change window.

; Set the toggle variable to off
toggle := 0
keybind := "e"
delay := 200

; Set the send mode to input (may not be necessary depending on your system)
SendMode Input

; Define the function to send the keystroke
SendKey:
    IfWinActive, World of Warcraft
    {
        Loop {
            if not GetKeyState(keybind, "P") {
                break
            }
            if GetKeyState("LCtrl", "P") {
                SendInput ^{%keybind%}
            } else if GetKeyState("LShift", "P") {
                SendInput +{%keybind%}
            } else if GetKeyState("LAlt", "P") {
                SendInput !{%keybind%}
            } else {
                SendInput {%keybind%}
            }
            sleep delay
        }
    }
return

#IfWinActive, World of Warcraft ; Only run if window 'World of Warcraft' is active
$F10::
    toggle := !toggle
    if (toggle) {
        SetTimer, SendKey, %delay%
    } else {
        SetTimer, SendKey, Off
    }
return

$F12::
    InputBox, delay, Delay, Enter new delay in ms (min 50), 200, 140, , , , , , , ; Prompt to change the delay
    if ErrorLevel {
        return
    }
    if (delay < 50) ; Ensure delay is not less than 50ms
        delay := 50
    SetTimer, SendKey, %delay%
return
#IfWinActive

; If World of Warcraft is not running, turn off the script
#IfWinNotExist, World of Warcraft
    SetTimer, SendKey, Off
    toggle := 0
#IfWinActive

Hope this comes in useful for people :slight_smile:

-Fredrik Feros Haugli

for some reason wont even toggle on and off for me using the latest version of AHK

Odd, I’m still using it. I start it (double check in the corner that you see the symbol in windows), open WoW and press F9 for Q then F11 to adjust Q speed.

All must happen inside the game, not while you are tabbed out :slight_smile:

Is there a reason for that you still use V1 / v1.137.01?

where do you see version in this O.o ?
Unless I get a prompt that tells me to update, I wont go out looking for it :slight_smile: Why upgrade something that works ^^,

its on the https://www.autohotkey.com/ website, when you click download it show version 2.0 and version 1.1 (deprecated)