Hi.
Below is a script that was taken out of a book and tweaked slightly. For some reason, the ratings aren’t being displayed in iTunes. According to AppleScript, the songs are rated (as is evident when you click “Unrated”) but the stars don’t show! Please help.
on songRater()
tell application "iTunes"
activate
set unratedSongs to every track of playlist "Library" whose rating is 0
set allSongs to every track of playlist "Library"
set whichSongs to the button returned of (display dialog "Do you want to rate all your songs or just the ones that haven't been rated yet?" buttons {"Cancel", "All songs", "Unrated"} default button 3)
if whichSongs = "Unrated" then
repeat with currentSong in unratedSongs
play currentSong
set currentName to the name of currentSong
set currentArtist to the artist of currentSong
set newRating to the text returned of (display dialog "Current song: " & currentName & return & "Artist: " & currentArtist & return & "Enter your rating (1-5):" default answer 3)
set rating of currentSong to newRating
end repeat
else if whichSongs = "All songs" then
repeat with currentSong in allSongs
play currentSong
set currentName to the name of currentSong
set currentArtist to the artist of currentSong
set newRating to the text returned of (display dialog "Current song: " & currentName & return & "Artist: " & currentArtist & return & "Enter your rating (1-5):" default answer 3)
set rating of currentSong to newRating
end repeat
end if
display dialog "All your songs are rated."
end tell
end songRater
songRater()