This is what can be found in the AHK Help file but adjusted to your needs. If you have any question, just ask. Have fun.
Code:
#MaxThreadsPerHotkey 3
LAlt:: ; Left Alt hotkey (change this hotkey to suit your preferences).
#MaxThreadsPerHotkey 1
if KeepLoopRunning ; This means an underlying thread is already running the loop below.
{
KeepLoopRunning := false ; Signal that thread's loop to stop.
return ; End this thread so that the one underneath will resume and see the change made by the line above.
}
; Otherwise:
KeepLoopRunning := true
Loop
{
; The next lines are the action you want to repeat (update them to suit your preferences):
Send {Right}
Sleep 1500 ; Gives you time for your editting the gaps, 1000 = 1 second (change to whatever you want)
Send {Left}
Sleep 1500
; But leave the rest below unchanged.
if not KeepLoopRunning ; The user signaled the loop to stop by pressing Win-Z again.
break ; Break out of this loop.
}
KeepLoopRunning := false ; Reset in preparation for the next press of this hotkey.
return