Windows – Need assistance with making a AHK Text spam script

autohotkeyscriptwindowswindows 10

I hope your all doing well! I'm a gamer with little to no knowledge about scripting, in a game I'm trying to make an auto hotkey script that will press the slash key first and then copy-paste the following text ''explode all''[I'm not sure 100% about this but it will somehow type this text or paste it through crtl+v] and then it will press enter and repeat every 30 milliseconds. I've tried making this through this article but this is pretty close to what I'm trying to do. https://www.howtogeek.com/97998/how-to-make-your-computer-press-a-key-every-x-seconds/, In a nutshell, I need to make a script that will press the following keys on my keyboard including the slash and enter button and repeat continuously every 30 milliseconds, also will need to know how to switch this on and off. Please make me this / guide me on how to make it.

Best Answer

The following script might get you started (as I have not tested it). The script starts and ends sending with the F12 key. If the target program is too slow to accept its input, you might need to add some Sleep commands, for example between the / and the rest.

working = 0
SetKeyDelay, 10

F12::
If (working = 0) {
   working = 1
   SetTimer, SendString, 30
} else {
   working = 0
   SetTimer, SendString, Off
}   
return

SendString:
Send, /explode all{Enter}
Return
Related Question