I’m a keyboard person, that is I prefer to use the keyboard as much as possible. It’s doesn’t matter that there are good metrics to show how much slower using a keyboard is, it’s just the way I’m wired.
So iTunes is a particular pain for me - as it doesn’t let me change the rating of a song from the keyboard - at least not fresh out of the box.
We’re going to change that.
Step 1
First up we need to think about what keyboard shortcuts you want to assign to each of the commands in the ratings menu (shown to the right). You don’t wan’t to conflict with any shortcuts that already exist in the application and you want them to be easy to remember and finally you don’t want some difficult to execute combination.
From looking at iTunes, I can see that video size uses ⌘0 - ⌘3 but for me that’s not an issue as I tend to watch iTunes video on a TV or iPhone not my Mac. (If it really worries you, you can use ⇧⌘0 - ⇧⌘5 to change the rating - where ⇧ is the Shift key.)
For this exercise I’m going to use the following keyboard shortcuts -
- ⌘0 - for “None”
- ⌘1 - for “★”
- ⌘2 - for “★★”
- ⌘3 - for “★★★”
- ⌘4 - for “★★★★”
- ⌘5 - for “★★★★★”
I’ll also setup a keyboard shortcut for increasing and decreasing the current rating of a song, for that I’ll use:
- ⌘↑ - for “Increase by 1”
- ⌘↓ - for “Decrease by 1”
At this point the observant will have noted that there is no menu item to increase/decrease rating - we’ll fix this with a few very simple AppleScripts.
Most people tend to forget (or just don’t realise) that Mac OS X allows you to set “Keyboard Shortcuts” for any menu item through the Keyboard System Preferences panel. All you need are the application name (iTunes), the menu item names (shown above) and what shortcut you want to assign to each menu item.
Step 2
Find and open the Keyboard preferences and lets get straight into it.
Step 2
Under the Keyboard tab, make sure the “Show Keyboard & Character Viewer in menu bar” preference is ticked, like the screenshot below.
Step 3
Once you’ve done that you’ll want to click on the “Keyboard Shortcuts” tab and then in the source list you will need to click on the last entry “Application Shortcuts”
Step 4
Click the “+” button to add a new keyboard shortcut. This will bring up a panel that allows you to select the application, enter a menu title and specify the keyboard shortcut you want to assign. First step select iTunes from the application list - if you don’t the Shortcut will be applied to all applications.
The first iTunes shortcut we’ll set up is for “None” and we’ll use the easy to remember shortcut ⌘0

Type “None” into the menu title field, making sure it’s exactly the same as the entry in your iTunes menu, then advance to the keyboard shortcut field and set the shortcut by typing ⌘0 on your keyboard.
Finally click the Add button, and you’ve done the first shortcut.
Step 5
This process seems easy doesn’t it, and it is, as long as you can type the correct menu name into the interface. Setting shortcuts for rating 1 to 5 stars is not so easy, for starters most of us don’t have a ★ key on our keyboards. This is where the Character Viewer comes in very handy, in your menu bar, on the right-hand side you will find the Character menu (it looks like a little box with an * inside it. Click on that to reveal the menu, like this one:

Select the Character Viewer to get a window that floats above everything and looks like this:
If your Character Viewer doesn’t look like this you may have to select “Roman” from the View menu in the top left corner of the Characters window. Once you’ve got the “Roman” view select the ★ Stars/Asterisks entry in the source list on the left (as shown in the screenshot). The very first star you see should be the “BLACK STAR” and it should be already selected.
Step 6
Now to create the shortcuts for ratings 1 to 5. It’s really quite simple, as with Step 4 we click the “+” button to add a new keyboard shortcut. If you’ve done each step correctly so far iTunes will still be the selected application, so all we have to do is enter the name and set the key combination.
With your Character Viewer window still open click in the text box for the menu title and then double click on the ★ glyph. This will insert the glyph into the menu title. Next set the keyboard shortcut field to ⌘1 as shown in the screenshot. Then click the Add button.

Steps 7 - 10
Repeat Step 6 increasing the number of ★ glyphs and setting the appropriate shortcut keys, until you’ve created the shortcut for a 5 ★ rating, as shown below.

Step 11
The final two keyboard shortcuts require a bit of AppleScript, - don’t panic it’s easy. As mentioned previously iTunes doesn’t have menu items to increase or decrease a rating, rather you directly set the value you want.
We’re going to create two simple scripts and make them appear in the iTunes script menu (it’s the one to the left of the Help menu that looks like a scroll.)
The scripts that I’m using below are pretty simple, first up they get the current selection from iTunes. In iTunes the current selection is not necessarily the currently playing/paused track.
If the selection isn’t empty, we store the selected tracks in sel and then work through each item in the selection. Depending on the script we either add or subtract 20 from the rating value. Why 20? Well iTunes actually uses a 0 to 100 range for ratings and each star is 20 points on the scale. (For bonus fun see what happens with increments of 10). NB. this script works on the selection, so if you have multiple items selected it will adjust all of them.
Open Script Editor and paste in this:
Script #1
tell application "iTunes"
if selection is not {} then
set sel to selection
repeat with tTrack in sel
set orig_Rating to the rating of tTrack
set tName to the name of tTrack
set new_Rating to orig_Rating - 20
if new_Rating < 0 then
set new_Rating to 0
end if
set rating of tTrack to new_Rating
end repeat
end if
end tell
Save the script into
/Users/yourname/Library/iTunes/Scripts/with a suitable name - I used "Rating Decrease by 1" and for the next I used "Rating Increase by 1". See what I did there? Using the same word "Rating" at the beginning of each script means that it will sort them adjacent to each other in the Script menu.
Script #2
tell application "iTunes"
if selection is not {} then
set sel to selection
repeat with tTrack in sel
set orig_Rating to the rating of tTrack
set tName to the name of tTrack
set new_Rating to orig_Rating + 20
if new_Rating > 100 then
set new_Rating to 100
end if
set rating of tTrack to new_Rating
end repeat
end if
end tell
Repeat those steps for Script #2 saving it as “Rating Increase by 1” into the same folder. Once you’ve done that if you check your Script menu in iTunes it will look something like this:

Of course, you will be missing the keyboard shortcuts.
Step 12
Go back to the Keyboard Shortcut preferences tab and add two more entries that should look like this:


If you need to refer back to Step 4.
That’s it you’re done.
Open iTunes and enjoy the keyboard goodness.





I've been described as a lost technocrat or a wondering luddite, personally I just like everything that takes us forward.