Skip to content

Instantly share code, notes, and snippets.

@tydira
Created May 4, 2014 05:38
Show Gist options
  • Save tydira/da2717296142ec4ffcae to your computer and use it in GitHub Desktop.
Save tydira/da2717296142ec4ffcae to your computer and use it in GitHub Desktop.
tell application "Finder"
set frontApp to name of first process whose frontmost is true
end tell
set thisTrack to ""
tell application "iTunes"
if player state = playing then
set thisTrack to current track
set thisName to name of current track
set thisArt to artist of current track
set numList to {"0", "1", "2", "3", "4", "5"}
set thisRating to rating of thisTrack
end if
end tell
tell application frontApp
if thisTrack is not "" then
if thisRating is not 0 then
set thisRating to (thisRating / 20)
end if
set thisList to (choose from list numList with prompt "Rating:" default items thisRating OK button name "Rate")
end if
end tell
if thisList is not false then
set thisRating to ""
repeat with i from 1 to count of items of thisList
set thisItem to item i of thisList
set thisRating to thisItem * 20
tell application "iTunes"
set rating of thisTrack to thisRating
end tell
end repeat
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment