Toggled Keyboard Input Loop

Hi, I wanted to know if anybody knows how I could create a toggle macro to repeatedly wait one second, input space, wait another second, then input backspace. I've tried setting up a Start Repeat / For Loop followed by the key, a delay, then ending the loop. I set the repeat on the initial loop to a varying values, but it either crashes or ends after roughly 30 minutes.

Have you already attempted using AppleScript? You could then also trigger it through BetterTouchTool.

Something like this

delay 1
tell application "System Events" to keystroke space
delay 1
tell application "System Events" to keystroke (ASCII character 8)
end repeat

I haven't, but that does work. How would I enable/disable it by using a toggled key combination? i.e. CMD+4

Thanks, so pressing CMD+4 executes that script, but how would I end it?

Here is an attempt to address the issue within BetterTouchTool (BTT):

  1. Input Space
  2. Pause
  3. Delete Character
  4. Pause
  5. If Condition (active_app_name is not Sublime Text)
  6. Heads-Up Display (HUD) Indicates STOP
  7. If the condition holds true, then No Action
  8. Otherwise, HUD Displays GO
  9. #4 (Restart the Process)
  10. End of IF

This should ideally continue running as long as the application in which the process is intended to operate remains active. In this example, Sublime Text. If you activate a different app, the process will come to a halt. The Heads-Up Displays (HUD) indicate whether it is either running or has been terminated.


I tried using this and it crashed after a few minutes. The original idea of using the applescript works, but it seems to turn off after a while for some reason.

I'm sorry, but it sounds like you might be facing a local issue with your machine, as I'm not encountering any problems on my end. Unfortunately, I won't be able to help you further.

All good, thank you for your time and help!