Перше, що рейтингове значення просто зберігається як "рейтинг". Але iTunes зберігає рейтинг зірок як значення між 0 і 100, тому вам потрібно перетворити з цього значення на кількість зірок.
Це може бути розумніший спосіб зробити це, але цей код, здається, працює.
tell application "iTunes"
set theTrack to (item 1 of (get selection))
set theRating to rating of theTrack
if theRating = 100 then
set comment of theTrack to "5 Star"
else if theRating ≥ 80 then
set comment of theTrack to "4 Star"
else if theRating ≥ 60 then
set comment of theTrack to "3 Star"
else if theRating ≥ 40 then
set comment of theTrack to "2 Star"
else if theRating ≥ 20 then
set comment of theTrack to "1 Star"
else if theRating = 0 then
set comment of theTrack to "0 Star"
end if
end tell