Question

I need something that repeats the keyboard keys "up, left, down and right" and repeats endlessly until the insert key is pressed to pause it. I'm not sure how i should approach this. Could someone help point me in the right direction?

Was it helpful?

Solution

I am not on a windows computer at the moment, so this code is untested

This is for ahk_L not ahk_basic.

You will need to create a hotkey to start this loop. You should also make sure this runs only on the window you are indending, as well as a way to quickly exit the script, as the script may run away from you, causing you to restart the computer.

; While the physical insert key is up, send the keystrokes
While(!GetKeystate("Insert","D")) {
   Send {Up}{Left}{Right}{Down}
}

If this is for a game, (and I suspect it might be) you might need to use a difrerent send mode. See the Autohotkey FAQ for info on that particualr topic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top