Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --iTunes talks to growl (pre-alpha) ;)
  2. --register notification with growl (only needed one time)
  3.  
  4. tell application "GrowlHelperApp"
  5.     register as application "iTunesNotify" all notifications {"iTunesTrackNotify"} default notifications {"iTunesTrackNotify"} icon of application "itunes.app"
  6. end tell
  7.  
  8. --let iTunes send notifications
  9. tell application "iTunes"
  10.     set iTunesNotifiedID to -1
  11.     repeat
  12.         try
  13.             --send current track name and album to prowl
  14.             if player state = playing then
  15.                 if database ID of current track is not equal to iTunesNotifiedID then
  16.                     set iTunesTitle to name of current track as text
  17.                     set iTunesAlbum to album of current track as text
  18.                     tell application "GrowlHelperApp"
  19.                         notify with name "iTunesTrackNotify" title iTunesTitle description iTunesAlbum application name "iTunesNotify"
  20.                     end tell
  21.                     set iTunesNotifiedID to database ID of current track
  22.                 end if
  23.                 delay 1
  24.             end if
  25.             --other notifications go here
  26.         on error number -609
  27.             --exit the loop when the user quits iTunes
  28.             exit repeat
  29.         end try
  30.     end repeat
  31. end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement