property theTrack : "" property nbPlays : 0 tell application "iTunes" if player state is playing then set theTrack to the current track set nbPlays to the played count of theTrack end if end tell on idle tell application "iTunes" if player state is playing then if theTrack is not the current track then -- New Song if nbPlays is not the played count of theTrack then -- The song was played in full length. set theRating to the rating of theTrack set theRating to theRating + (10 - theRating / 10) set the rating of theTrack to theRating else -- The song was skipped. set theRating to the rating of theTrack set theRating to theRating * (1 - (10 - theRating / 10) / 100) set the rating of theTrack to theRating end if set theTrack to the current track set nbPlays to the played count of theTrack end if end if end tell return 5 end idle