1

Okay, so I have a non-Apple keyboard and wanted to bind function keys to the basic media controls such as play/pause iTunes, change volume etc. So I decided to create a service in Automator with an Applescript task to perform the desired action, these are all configured for no input and availability of "Any application".

Here's a simple example for the play/pause iTunes script that I'm placing into the Automator workflow:

on run {input, parameters}
    tell application "iTunes"
        if player state is not playing then
            play
        else
            pause
        end if
    end tell
 end run

This seems simple enough, and once saved it appears under System Preferences -> Keyboard -> Shortcuts -> Services where I can set a shortcut key such as F1.

However, while the command works fine from a few applications such as Safari, the Finder and iTunes itself, it won't work at all in Mail, and actually doesn't work in Automator!

Instead of the script running, I just get a system beep sound. At first I assumed the problem was that these apps assigned other commands to the function keys, but as far as I can tell that isn't the case (unless I've missed some commands), so I'm at a loss as to why my shortcuts aren't working.

Is there something else that could be preventing my script(s) from triggering?

  • For those experiencing the same trouble, I found a program called BetterTouchTool; it's a free app that lets you configure a wide range of shortcuts and even enables a Windows style window snapping feature. I'd still like to know why I can't get Applescript to work, but this app solves the problem (and is better in many ways). – Haravikk Dec 8 '14 at 10:28

You must log in to answer this question.

Browse other questions tagged .