Hey, I did some searching and found a thread to which you had responded to for captions. Based on that, I've come up with this:
Code: Select all
winTitle = ahk_exe game.exe
#MaxThreadsPerHotkey 2
#If WinActive(winTitle)
$q::
SoundBeep, 1000, 250
SetTimer, Q, 250
text = Spam ON
Gui, -Caption +AlwaysOnTop
Gui, Font, s14
Gui, Add, Text,, %text%
Gui, Show, x5 y20
Q:
Send q
Return
QStop:
SetTimer,, Off
SetTimer, Q, Off
SoundBeep, 1000
Gui, Hide
Return
~z::
Loop, Parse, % "q"
Gosub, %A_LoopField%Stop
SoundBeep, 250, 250
Gui, Hide
Return
I'm seeing several issues:
1. When I press "Q" the first time, the script spams several Windows error sound. Unsure why.
2. If I press "Q" a second time, the Q key does not stop spamming. Also, Windows goes haywire with the error sound. It also does not hide the GUI element, even though that's part of the function. Almost seems like the QStop function isn't working at all.
3. Pressing "Z" stops the script properly and hides the GUI element as well.
Would you be able to assist with solving issues 1 and 2?
Thank you.