Created
July 29, 2009 05:38
-
-
Save itspriddle/157887 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
create an entry in ~/.netrc for your twitter username/password: | |
machine twitter.com | |
login myusername | |
password mypassword |
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
(* Check if iTunes is running and grab current song / artist / album *) | |
tell application "System Events" | |
if exists process "iTunes" then | |
tell application "iTunes" | |
if player state is playing then | |
set current_song to (name of current track) as Unicode text | |
set current_artist to (artist of current track) as Unicode text | |
if current_artist is equal to "" then set current_artist to "Unknown" | |
set music_playing to "♫ " & current_song & " - " & current_artist | |
end if | |
end tell | |
else | |
if button returned of (display dialog "iTunes isn't running" & return & "" buttons {"Wait", "Quit"}) is "Quit" then quit | |
end if | |
end tell | |
set the_status to quoted form of ("status=" & music_playing) | |
try | |
do shell script "curl -n -d " & the_status & " https://twitter.com/statuses/update.xml --insecure" | |
on error | |
open location "x-launchbar:large-type?string=There+was+an+error+sending+your+tweet.+Please+try+again." | |
end try |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment