PDA

View Full Version : Gui Script - Rating tracks in itunes




erikssonfx
Jun 24, 2012, 07:59 PM
Hello I need a script to rating the current track automatically. With the following script it isn't possible because theres an error by "★★★★★". Although this is actually the correct term. (I need to stretch the code with delays because the viewer should see the automatic-action)

tell application "iTunes"
activate
end tell
delay 1
tell application "System Events"
tell process "iTunes"
key code 120 using control down
delay 1
tell menu bar 1
click menu bar item "Ablage"
end tell
end tell
end tell
delay 1
tell application "System Events"
tell process "iTunes"
delay 1
tell menu bar 1
tell menu "Ablage"
click menu item "Wertung"
end tell
end tell
end tell
end tell
delay 1
tell application "System Events"
tell process "iTunes"
delay 1
tell menu bar 1
tell menu "Ablage"
tell menu "Wertung"
click menu item "★★★★★"
end tell
end tell
end tell
end tell
end tell



kryten2
Jun 24, 2012, 09:36 PM
tell application "iTunes"
if player state is playing then
set myTrack to current track
-- ★=20 so ★★★★★=100
set rating of myTrack to 100
end if
end tell

You can set the rating from the iTunes icon in the dock too.

erikssonfx
Jun 25, 2012, 02:27 PM
thanks for the advice. I want to recreate natural actions, so i used the tell-orders to get to the rating item. then i closed all and faked it with your short code.