2

I am looking for a method that allows me to press and hold down a key, for example "X", and instead of pressing just once, I want it to be read as multiple presses in a very short period of time. So for example, 0.1s delay between the presses, and the pressing per say, continues until I release the key.

  • Custom apps to do this are fine.
  • Scripts and automation of any language are fine (I can install frameworks or languages if it gets me to my goal)
  • Third party scripting apps are fine.
  • Third party accessibility apps or hardware solutions are fine

I am trying to target the Firefox process for these repeated key press bursts.

Here's my research showing how close I can get with a script, and tried modifying it to apply to my situation, opened it via "Automator" but the functionality is wrong:

tell application "System Events"
  delay 0.1
  keystroke space using command down
  delay 0.1
  keystroke space using command down
  delay 0.1
  keystroke space using command down
  delay 0.1
  keystroke space using command down
  delay 0.1
  keystroke space using command down 
end tell

Moreover, I wanted the script to work on a "X" key, but this particular script sends space bar requests. And even if this worked, it would just press 5 times (or as many times as I would copy and paste the 'keystroke' line), but I want to have it stopped when I release the key. (If this is not possible, I am okay with having certain amount of presses as well, somewhere around ~20 would be nice)

  • 1
    I recall some question here a while back where the other person was asking "how can I script something where it spams the space key as fast as possible and then stops?" I think it was for gaming or some thing where you got currency or resources or won a battle if you could press space faster than another human might try. I'll link to that question if I find it. Could you edit your post - the part where it says "it didn't work" is unclear - do you mean the design / functionality is wrong and you need better smarts or that you can't get that script to run. You might one question for each Q. – bmike Sep 12 '18 at 19:57
  • 1
    After editing this - you could remove the script entirely - ask how to change the space to X and increase to 20 and get an answer. Then link to that question here showing why your script isn't good enough. – bmike Sep 12 '18 at 20:00
  • 1
    Thank you @bmike so much for clarifying how to ask the question better and thank you for editing my post so nicely. I'll try to ask another question regarding this particular script, but I might wait for a while for an answer on this one, if that's fine. – G. ILL Sep 13 '18 at 8:22

You must log in to answer this question.

Browse other questions tagged .