<
 

Assign Shortcut Keys to iTunes AppleScripts

Mac OS 10.3, Panther, introduced the ability to assign menu shortcut keys to pretty much every application, including iTunes. And including AppleScripts in iTunes' Scripts Menu. Here's how to do it.

(If you don't want to do-it-yourself, FastScripts from Red Sweater Software provides the ability to quickly and simply add shortcuts to AppleScripts.)

Step 1: Set Up Your System Preferences

For Panther & Tiger Operating Systems:

Note: This will only work with scripts that have been installed in your [username]/Library/iTunes/Scripts or [startupdisk]/Library/iTunes/Scripts folder.

Quit iTunes. You can't attach a keyboard shortcut to an application if it is running.

Open your System preferences and click on "Keyboard & Mouse" in the Hardware row. Click on the "Keyboard Shortcuts" tab.

Click on the "+" button to add a new shortcut. In the Application pop-up of the window that appears, select iTunes. Beneath this pop-up in the Menu Title field enter the name of the AppleScript in iTunes Scripts Menu to which you want to assign a keyboard shortcut. Better write it down before you quit iTunes because spelling counts! In the Keyboard Shortcut field press the combination of keys you want to use for the shortcut.

setting shortcuts
Setting the shortcuts for the Google Lyric Search script. The key combination I pressed is Command-Option-G.


Close System Preferences.

The next time you start iTunes, look in its Scripts Menu. The shortcut you assigned will be displayed adjacent to the name of the Script you assigned it to, just like a "real" menu shortcut! That's because it is a real menu shortcut.

For more details, search your Mac Help for "Setting custom keyboard shortcuts for applications".

ALSO, I have written a script, Script Shortcut Maker, that is essentially a fancy AppleScript wrapper for some shell defaults commands that assign the keyboard combinations to your scripts directly to iTunes' preferences .plist. You can read more about these commands here.

Step 2: OK. Now What?

Here's how I set up some of my scripts:

If you assign a keyboard shortcut which iTunes is already using, you may get mixed results. For example, I assigned Shift-Command-A to a script and iTunes' "Select None" shortcut was disabled (the menu command still worked). But it wouldn't let me assign Command-A, the universal "Select All" shortcut. It also knows what keys you have assigned already, and it will warn you if you try to enter a duplicate shortcut.

As far as using the F keys: I could only get combinations that included Command to work. Of course, this could be my keyboard. I use a wireless Logitech that has its own Preference Pane for F keys and it's possible they are interfering. No problem, though. There are still hundreds of key combinations available.

Sometimes I had to quit and re-start iTunes a second time before the shortcut "took". Maybe that's just my system.

Check out theMissing Menu Commands page for some scripts that work great as shortcuts.

This column is printer-friendly.
home | scripts | tips & info | forum at iLounge | rssfeed rss
Site contents © 2001 - 2008 Doug Adams and weblished by Doug Adams, dougscripts AT mac DOT com. All rights reserved. Legal.
AppleScript, iTunes, and iPod are registered trademarks of Apple Inc.
This page was served using PHP. Be that as it may—whatever that means—this page was last modified by human hands on August 2, 2007.

"People make a lot of fuss about my kids having such supposedly strange names, but the fact is that no matter what first names I might have given them, it is the last name that is going to get them in trouble." - F. Zappa