Created
March 14, 2012 15:04
-
-
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)
This file contains 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
-- 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