Is it possible that holding down a keyboard would trigger the Apple Script all the time?
  • First of all, thanks for this great application!
    I managed to control iTunes skip forward and skip backward (e.g. with 5 secs) with an Apple Script (which I couldn't do as a Service: sometime it was working but mostly isn't :) )

    The script is:
    tell application "iTunes"
    if player state is stopped then return
    set player position to (get player position) + 5
    on error errMsg number errNum
    tell me
    display alert errMsg & return & return & "Error number" & errNum buttons "Cancel"
    end tell
    end try
    end tell

    I assigned F17 to it and all is working fine, but I miss 1 thing: when I hold down F17 I'd want the script to be fired up frequently until I release the key. How can I achieve this?

  • Daniel JalkutDaniel Jalkut
    Accepted Answer
    Hi chros - glad you are enjoying FastScripts!

    Unfortunately I don't think there is any trivial way to achieve this kind of functionality. As far as I know there is no mechanism within AppleScript itself to check whether a specific key is currently being held down. I think to achieve what you're looking for a script would have to:

    1. First do what your script above does.
    2. Then repeatedly check whether the expected keyboard shortcut is still down, and repeat the action.

    I can imagine possibly doing this with the aid of some kind of external tool written in a language that can "bridge" to Apple's typical programming frameworks like CoreFoundation or Cocoa. But that would be quite an adventure and I am afraid I don't have a lot of advise for how to tackle that.
  • Daniel JalkutDaniel Jalkut
    Accepted Answer
    (All that said, I'll take it as a feature request and will consider a possible future option that would enable re-running a script if the key is held repeatedly).
  • Thanks Daniel for your quick answers and waiting for the implementation of my feature request! :)
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!