Skip to content

Instantly share code, notes, and snippets.

@dulichan
Created March 17, 2013 01:08
Show Gist options
  • Save dulichan/5179088 to your computer and use it in GitHub Desktop.
Save dulichan/5179088 to your computer and use it in GitHub Desktop.
A small script to tweet the now listening song
tell application "iTunes"
if player state is playing then
set myTrack to current track
copy name of myTrack to nameOfTrack
copy artist of myTrack to artistOfTrack
tell application "System Events"
tell process "Notification Center"
click menu bar item 1 of menu bar 1
click button 1 of UI element 1 of row 2 of table 1 of scroll area 1 of window "window"
#display dialog nameOfTrack
keystroke "Now listening to " & nameOfTrack & " by " & artistOfTrack & " #nowListening"
keystroke "D" using {command down, shift down}
keystroke space
end tell
end tell
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment