Keyboard Entry to stop loop

Hi all. I’m very new to the AppleScript world. I’m hoping I can find out if what I would like to do is even possible.

I have a loop that is running a certain program over and over. I would love to be able to use a key on the keyboard to exit the loop. My loop and script is very simple, so it doesn’t need to go to a different part in the script or anything. I just want it to abort the action. I’d prefer the key be spacebar, because it’s an audio program and most audio programs start and stop using spacebar (such as iTunes).

So one more time, just to clarify. I’d like to receive a ‘spacebar’ press to start and stop my loop upon request. Is it possible??

Thanks!

Hi,

you can’t do this in plain vanilla AppleScript,
but it is possible in AppleScript Studio.

However, as the space bar is no standard key equivalent, it requires also a portion of Objective-C to implement the function