Created
September 30, 2010 18:55
-
-
Save myell0w/605099 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Start Genius for current playing track and display Growl Notification | |
tell application "iTunes" | |
activate | |
set curr_track to name of current track | |
set curr_artist to artist of current track | |
set visible of front browser window to true | |
end tell | |
tell application "System Events" | |
set button_count to count every button of window "iTunes" of application process "iTunes" | |
repeat with i from 1 to button_count | |
set button_description to accessibility description of button i of window "iTunes" of application process "iTunes" | |
if button_description is "genius" then | |
set x to i | |
end if | |
end repeat | |
if enabled of button x of window "iTunes" of application process "iTunes" then | |
click button x of window "iTunes" of application process "iTunes" | |
end if | |
end tell | |
tell application "System Events" to set visible of process "iTunes" to false | |
tell application "GrowlHelperApp" | |
set the allNotificationsList to {"Genius Notification"} | |
set the enabledNotificationsList to {"Genius Notification"} | |
register as application "Genius iTunes Script" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "iTunes" | |
-- Send a Notification... | |
-- This one will appear because it was enabled by default. | |
notify with name "Genius Notification" title "Genius started" description curr_artist & " - " & curr_track application name "Genius iTunes Script" | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment