Spam Key only active while holding buttons

Ask gaming related questions (AHK v1.1 and older)
MrSprinkles
Posts: 1
Joined: 14 Jun 2018, 15:06

Spam Key only active while holding buttons

14 Jun 2018, 15:11

I have searched a bit and cant seem to find what I am looking for. I will post my code and see if someone can help me a bit with the proper format. I copied code from another post and it works but its too fast, I would almost prefer the spam to be half of what it is presently. I was also looking to get the hotkeys to only run with the game window open, but if thats not possible no biggie.
#IfWinActive, DayZ

ALT & F::

If State=50

State=Off

else

State=50

SetTimer SendKey, %State%

Return

SendKey:

Send F

Return
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Spam Key only active while holding buttons

14 Jun 2018, 17:42

Give this a try:

Code: Select all

#NoEnv

speed := 100                  ; Change this value to speed up or slow down the timer intervals. (100msec = 1/10sec 1000msec = 1sec)
WinTitle := "DayZ"            ; Make sure this matches the window title or the hotkey/send will not work

#IfWinActive, % WinTitle
$!F::SetTimer, SendKey, % (Toggle := !Toggle) ? speed : "Off"    ; Toggle the timer on/off

SendKey:
    if WinActive(WinTitle)    ; If the timer is running and the window is active send the key otherwise do nothing
        Send F
Return
HTH

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 36 guests