Skip to content

Instantly share code, notes, and snippets.

@rcarmo
Created March 14, 2012 15:04
Show Gist options
  • Save rcarmo/2037082 to your computer and use it in GitHub Desktop.
Save rcarmo/2037082 to your computer and use it in GitHub Desktop.
Tweet the current playing track in iTunes, complete with Grooveshark URL (use as Quicksilver trigger)
-- get properties of the playing track
tell application "iTunes"
set thisTrack to current track
set trackAlbum to the album of thisTrack
set trackYear to the year of thisTrack
set trackName to the name of thisTrack
set trackArtist to the artist of thisTrack
end tell
--
-- change the status message to your liking here:
set tweet to "is listening to " & trackName & " by " & trackArtist & " (" & trackAlbum & ", " & trackYear & ")"
-- assemble URL
set textVar to "http://grooveshark.com/#!/search?q=" & trackName & " " & trackAlbum
set AppleScript's text item delimiters to {space}
set itemList to (text items of textVar) as list
set AppleScript's text item delimiters to {"+"}
set textVar to (itemList as text)
set tweet to tweet & " " & textVar
-- wake up Twitter
tell application "Twitter"
activate
end tell
--brutally vandalize it
tell application "System Events"
set the clipboard to tweet
keystroke "n" using command down
keystroke "v" using command down
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment