-- TuneBlast by Brett Terpstra -- Monitors iTunes for track changes and sends track -- info with MoodBlast -- -- If iTunes isn't loaded it cycles checks every 30 seconds -- If iTunes is loaded but not playing it cycles every 15 seconds -- If iTunes is playing it cycles every 5 seconds looking for track changes -- -- Use the first letter of a service to select it below -- escept for Tumblr, which is "U" set blastTo to "si" -- Blast to (s)kype and (i)Chat set blankWhenNotPlaying to true -- Blank selected services when music stops global theTrack, blankedStatus set {theTrack, blankedStatus} to {null, false} repeat tell application "System Events" to get the name of every process if the result contains "iTunes" then tell application "iTunes" if player state = playing then if current track is not equal to theTrack then set theTrack to current track tell application "MoodBlast" to blast "^" & blastTo & " !itune" if blankedStatus is true then set blankedStatus to false end if set theDelay to 5 else if blankWhenNotPlaying is true and blankedStatus is false then tell application "MoodBlast" to blast "^" & blastTo & " !blank" set blankedStatus to true end if set theDelay to 15 end if end tell else set theDelay to 30 end if delay theDelay end repeat