Make iTunes Rating Easier with Keyboard Maestro

Page content

I really like the new iTunes 11 mini-player and it has replaced several apps that I’ve used for interface controls in the past.

The one trick that’s not available natively is a quick way to see and rate the currently playing track.1. I came up with a couple different ways to use Keyboard Maestro toward this end.

Macro Group Version

This is the version I really prefer. It consists of a new macro group that shows a palette for one action when triggered with ⌘+Shift+R. The group contains a macro for each star rating. Each macro in the group is triggered with the corresponding number key.

Macro groups in Keyboard Maestro are convenient ways to build multi-function palettes. The key is to set the “Shows a palette for one action when:” option to a hotkey. One hotkey brings up the palette of actions and then a second key will trigger one of the macros.

Each macro consists of one AppleScript action and one Display Text action. Here’s an example. The only real trick is know that iTunes AppleScript dictionary gets and sets ratings as an integer between 0 and 100. Each star rating corresponds to an interval of 20.

The secondary pop-up display is superfluous but acts as a nice confirmation of the rating change.

Text Input Method

This is a single macro that requests input of the star rating as a numeric value between 1 and 5. This method is less efficient but more accurate. I can use decimal values to set ratings like 1.5 stars.

Here’s the macro:

Here’s the AppleScript detail:

:::AppleScript
tell application "Keyboard Maestro Engine"
  set myVar to make variable with properties {name:"Rating"}
  set theValue to value of myVar
end tell

tell application "iTunes"
    set rating of current track to theValue*20
end tell

Now there are fancier ways to do this. I’ve used many of them. But when it comes down to it, I don’t usually care if I see the album art. I could do notifications with Growl but I’ve elected to keep Growl off of my new Mac until there is a better reason to use it. Keyboard Maestro notifications are simple and clean.

Homework

Want to add more power? Just add a “Next Track” action to the one or two star rating macros. That way you don’t have to sit through a crappy song longer than it takes to rate it.


  1. There are a number of ways to set keyboard shortcuts to set ratings. This method takes at least five shortcuts to span the range of 1 to 5 star ratings. I want one shortcut. ↩︎