Control iTunes from the keyboard

Nov 21, '02 07:34:46AM

Contributed by: Anonymous

How many times has the phone rang, and you've either had to dive for the mute button (on Extended keyboards), the volume knob, or iTunes itself? What a pain, particularly when you're in another application. Wouldn't it be nice if you could control iTunes using dedicated keyboard keys, like some programmable PC keyboards let you control Windows applications?

I haven't seen anyone using this exact method of controlling iTunes, and it seems to me to be one of the best and most intuitive. There are any number of AppleScripts and menu items available on the web, but none of them fit my needs. I tend to make large playlists and let them shuffle. My tastes in music being very broad, I often want to skip a particular song, or replay one I just heard, depending on the mood and/or occasion.

Requirements:

Either macro program lets you put custom commands onto the menu bar as well as trigger them via keystrokes (my preferred method). The bare minimum commands, in my opinion, are listed below. It's easy to add more. I use function keys F10, F11, and F12. With modifiers, many more commands are within easy reach of the right hand.

I've tested this with both Youpi Key and QuicKeys, and it is not within the scope of this hint to suggest which you should use. I'll demonstrate with Youpi Key as it is free; QuicKeys has a downloadble time-limited demo that can be used as well.

In the Youpi Key Editor, I added a new Shortcut: Run Script. I named the command "iTunes Play/Pause", assigned it F10, and entered...
tell application "iTunes"
playpause
end tell
...in the script window. Works like a charm, anywhere, anytime, instantly. Hitting it once starts a stopped or paused iTunes, launching it if necessary; hitting it again pauses iTunes, if playing. I also added scripts (to keys F11 and F12) that are almost identical: instead of "playpause", however, they say "previous track" and "next track", respectively.

Interestingly enough, this works even if a screen saver is running, at least with Youpi Key. If you normally password-protect your screen saver, be careful what scripts you attach as macro to keys! The screen saver will continue to run, however, so it would be hard to do much damage without access to the desktop or GUI.

The final step to complete this effort at further automating iTunes requires iTunes Notifier. This fades in a floating window (customizable by you) for a preset (short) time with the name of the current track. This works well for me because I don't often remember the names and/or artists of music I don't listen to frequently. It's unobtrusive and can be made translucent, so it doesn't have to obscure your work. I find myself glancing at it only if I need to know the name of the song. Before I found this program, I had to switch back to iTunes via the Dock to find out the name of the currently playing song.

[Editor's note: You can, of course, use iTunes' contextual menu in the dock (control-click on the dock icon) to do exactly what this hint describes, but that would require using the mouse. It's nice to have a keyboard-only alternative.]

Comments (37)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20021121043446531