Code to press R every 5 seconds
Code to press R every 5 seconds
I need a program to press R on my keyboard every 5 seconds, over and over. I'd like to switch it on and off with F2. Can someone give me the code for this I would be very grateful
Re: Code to press R every 5 seconds
Code: Select all
F2::
+F2::
If press := !press {
Gosub, PressR
SetTimer, PressR, 5000
} Else SetTimer, PressR, Off
SoundBeep, 1000 + 500 * press
Return
PressR:
Send R
Return
Re: Code to press R every 5 seconds
how would i do this for A being the key to be entered on a game continuously? i tried this code with A instead of R and it worked but not on my gamemikeyww wrote: ↑01 May 2021, 19:45Code: Select all
F2:: +F2:: If press := !press { Gosub, PressR SetTimer, PressR, 5000 } Else SetTimer, PressR, Off SoundBeep, 1000 + 500 * press Return PressR: Send R Return
Re: Code to press R every 5 seconds
If it works in Notepad but not in your game, then the issue might be how your game is responding to the script. You could have a look at the tips for games.
https://autohotkey.com/board/topic/111737-how-to-make-ahk-work-in-most-games-the-basics/
https://autohotkey.com/board/topic/111737-how-to-make-ahk-work-in-most-games-the-basics/