-- RATING script ---------------------------------------------------------------------------------------- property emdash : Çdata utxt2014È as Unicode text property black_star : Çdata utxt272FÈ as Unicode text property white_star : Çdata utxt2606È as Unicode text property dot : Çdata utxt00B7È as Unicode text set appName to "GrowlHelperApp" set app2Name to "iTunes" tell application "System Events" set appIsRunning to (name of processes contains appName) and (name of processes contains app2Name) end tell if appIsRunning then tell application "iTunes" if class of current track is in {track, file track, URL track, device track, shared track, audio CD} then (* Increments of 20, from 0 to 100 for 0 - 5 stars *) set rating of current track to 100 end if my notifyTrack(current track, player position, "5 Stars") (* or whatever else you want *) end tell end if on notifyTrack(myTrack, pos, txt) tell application "iTunes" set trkName to name of myTrack set trkArtist to artist of myTrack set trkAlbum to album of myTrack set trkTime to time of myTrack set trkRating to (rating of myTrack) / 20 set trkPos to my getTimeString(pos) set artworkCount to count of artwork of myTrack if artworkCount > 0 then tell myTrack set trkArt to (data of artwork 1) end tell else set iTunesIcon to "Macintosh HD:Applications:iTunes.app:Contents:Resources:iTunes.icns" set trkArt to read (file iTunesIcon) as picture end if if (txt is equal to false) then set txt to trkName set trkInfo to trkPos & "/" & trkTime & " " & emdash & " " & my showStars(trkRating) & return & trkArtist & return & trkAlbum else set trkInfo to trkName & return & trkPos & "/" & trkTime & " " & emdash & " " & my showStars(trkRating) & return & trkArtist if (trkAlbum is not equal to "") then set trkInfo to trkInfo & " (" & trkAlbum & ")" end if end if end tell my showQSNotify(txt, trkArt, trkInfo) end notifyTrack on showStars(trkRating) set stars to "" repeat trkRating times set stars to stars & black_star end repeat repeat (5 - trkRating) times set stars to stars & " " & dot end repeat return stars end showStars on showQSNotify(txt, trkArt, trkInfo) tell application "GrowlHelperApp" set the allNotificationsList to {"Rating Change", "Song Skipping", "Song Info"} register as application  "Hotkey iTunes Notification" all notifications allNotificationsList default notifications allNotificationsList  icon of application "iTunes" if (trkArt is equal to missing value) then notify with name "Rating Change" title txt description trkInfo application name "Hotkey iTunes Notification" else notify with name "Rating Change" title txt description trkInfo application name "Hotkey iTunes Notification" pictImage the trkArt end if end tell end showQSNotify on showTrackInfo() try tell application "GrowlTunes" show current track end tell end try end showTrackInfo on getTimeString(secs) set no_seconds to the secs as number set no_minutes to no_seconds div 60 set no_seconds to no_seconds mod 60 if no_seconds < 10 then set seconds_text to "0" & (no_seconds as string) else set seconds_text to no_seconds as string end if if no_minutes ³ 60 then set no_hours to no_minutes div 60 set no_minutes to no_minutes mod 60 if no_minutes < 10 then set no_minutes to "0" & (no_minutes as string) end if set minutes_text to (no_hours as string) & ":" & (no_minutes as string) else set minutes_text to no_minutes as string end if return minutes_text & ":" & seconds_text end getTimeString -- RATING script ---------------------------------------------------------------------------------------- -- SKIPPING script -------------------------------------------------------------------------------------- property emdash : Çdata utxt2014È as Unicode text property black_star : Çdata utxt272FÈ as Unicode text property white_star : Çdata utxt2606È as Unicode text property dot : Çdata utxt00B7È as Unicode text set appName to "GrowlHelperApp" set app2Name to "iTunes" tell application "System Events" set appIsRunning to (name of processes contains appName) and (name of processes contains app2Name) end tell if appIsRunning then try tell application "iTunes" set myTrack to current track set dur to duration of myTrack set q1 to dur / 4 set q2 to q1 * 2 set q3 to q1 * 3 set q4 to dur - 3 set curPos to player position set counter to 0 set theList to {q1, q2, q3, q4, dur} set pos to 0 repeat while pos is less than or equal to curPos set counter to counter + 1 set pos to item counter of theList end repeat if pos is less than 1 then set pos to 1 set player position to pos if counter is greater than 3 then my notifyTrack(myTrack, player position, "Ending Song") else my notifyTrack(myTrack, player position, "Song Skip") end if (* my showTrackInfo() *) end tell end try end if on notifyTrack(myTrack, pos, txt) tell application "iTunes" set trkName to name of myTrack set trkArtist to artist of myTrack set trkAlbum to album of myTrack set trkTime to time of myTrack set trkRating to (rating of myTrack) / 20 set trkPos to my getTimeString(pos) set artworkCount to count of artwork of myTrack if artworkCount > 0 then tell myTrack set trkArt to (data of artwork 1) end tell else set iTunesIcon to "Macintosh HD:Applications:iTunes.app:Contents:Resources:iTunes.icns" set trkArt to read (file iTunesIcon) as picture end if if (txt is equal to false) then set txt to trkName set trkInfo to trkPos & "/" & trkTime & " " & emdash & " " & my showStars(trkRating) & return & trkArtist & return & trkAlbum else set trkInfo to trkName & return & trkPos & "/" & trkTime & " " & emdash & " " & my showStars(trkRating) & return & trkArtist if (trkAlbum is not equal to "") then set trkInfo to trkInfo & " (" & trkAlbum & ")" end if end if end tell my showQSNotify(txt, trkArt, trkInfo) end notifyTrack on showStars(trkRating) set stars to "" repeat trkRating times set stars to stars & black_star end repeat repeat (5 - trkRating) times set stars to stars & " " & dot end repeat return stars end showStars on showQSNotify(txt, trkArt, trkInfo) tell application "GrowlHelperApp" set the allNotificationsList to {"Rating Change", "Song Skipping", "Song Info"} register as application  "Hotkey iTunes Notification" all notifications allNotificationsList default notifications allNotificationsList  icon of application "iTunes" if (trkArt is equal to missing value) then notify with name "Song Skipping" title txt description trkInfo application name "Hotkey iTunes Notification" else notify with name "Song Skipping" title txt description trkInfo application name "Hotkey iTunes Notification" pictImage the trkArt end if end tell end showQSNotify on showTrackInfo() try tell application "GrowlTunes" show current track end tell end try end showTrackInfo on getTimeString(secs) set no_seconds to the secs as number set no_minutes to no_seconds div 60 set no_seconds to no_seconds mod 60 if no_seconds < 10 then set seconds_text to "0" & (no_seconds as string) else set seconds_text to no_seconds as string end if if no_minutes ³ 60 then set no_hours to no_minutes div 60 set no_minutes to no_minutes mod 60 if no_minutes < 10 then set no_minutes to "0" & (no_minutes as string) end if set minutes_text to (no_hours as string) & ":" & (no_minutes as string) else set minutes_text to no_minutes as string end if return minutes_text & ":" & seconds_text end getTimeString -- SKIPPING script -------------------------------------------------------------------------------------- -- ARTWORK script --------------------------------------------------------------------------------------- property myUserName : "Constantinos" property appName : "iTunes" tell application "System Events" to set appIsRunning to name of processes contains appName if appIsRunning then tell application "iTunes" try set myTrack to current track set trackName to name of myTrack if (trackName is equal to "") then set trackName to "Unknown Track" end if set trackArtist to artist of myTrack if (trackArtist is equal to "") then set trackArtist to "Unknown Artist" end if set trackAlbum to album of myTrack if (trackAlbum is equal to "") then set trackAlbum to "Unknown Album" end if end try end tell set artworkFilename to "/Users/" & myUserName & "/Library/Images/Music/" & trackArtist & "/" & trackAlbum & "/Tracks/" & trackName & "/Track.png" set deleteFilename to "Macintosh HD:Users:" & myUserName & ":Library:Images:Music:" & trackArtist & ":" & trackAlbum & ":Tracks:" & trackName & ":Track.png" set deleteCoverFilename to "Macintosh HD:Users:" & myUserName & ":Library:Images:Music:" & trackArtist & ":" & trackAlbum & ":Cover.png" set albumCoverFilename to "/Users/" & myUserName & "/Library/Images/Music/" & trackArtist & "/" & trackAlbum & "/Cover.png" set tempfile to "Macintosh HD:tmp:temporary.pict" tell application "Image Events" (* set artworkFile to (POSIX file artworkFilename) set myImage to open (artworkFile as alias) *) set myImage to open artworkFilename try save myImage as PICT in (file tempfile) on error try set deleteFilename to deleteCoverFilename set myImage to open albumCoverFilename save myImage as PICT in (file tempfile) on error return end try end try close myImage end tell tell application "iTunes" set myTrack to current track set artworkCount to count of artwork of myTrack set myArt to read (file tempfile) from 513 as picture if artworkCount > 0 then set data of artwork (artworkCount + 1) of current track to myArt else set data of artwork 1 of current track to myArt end if end tell tell application "Image Events" delete (file tempfile) delete (file deleteFilename) end tell end if -- ARTWORK script ---------------------------------------------------------------------------------------