Tweeting from QuickSliver

This script has now been superseded for Mac users with the new Twitter for Mac — as long as you install the Services Menu module for Quicksilver.

I am including the script here for archival purposes. Please remember to install TTYtter before using it. Thanks!

using terms from application "Quicksilver"

on process text QStweet

— See if message is longer than 140 characters

— If it is longer than 140, Send Growl msg to user

set wordcount to do shell script "echo " & quoted form of QStweet & " | wc -c"

set wordcount to do shell script "echo " & quoted form of wordcount & " | sed 's/^[ ]*//'"

if wordcount as integer > 140 then

my growlRegister()

growlNotify("Tweet too long", "(" & wordcount & ") characters")

return nothing

end if

— Send tweet using TTytter

set results to do shell script "/usr/local/bin/ttytter -status=" & quoted form of QStweet

— Inform User if QStweet is sent or if it failed.

my growlRegister()

if results contains "post attempt SUCCEEDED!" then

growlNotify("Tweet Sent", QStweet)

else

growlNotify("Error Sending Tweet", results)

return nothing

end if

— Sets iChat status message to QStweet

tell application "System Events"

if exists process "iChat" then

tell application "iChat"

set the status message to QStweet

end tell

end if

end tell

— Sets Skype Mood Text to QSTweet

tell application "System Events"

if exists process "Skype" then

set commandText to "SET PROFILE MOOD_TEXT " & QStweet

tell application "Skype"

send command commandText script name "QSTweet"

end tell

end if

end tell

end process text

end using terms from

using terms from application "GrowlHelperApp"

— Register Growl

on growlRegister()

tell application "GrowlHelperApp"

register as application "QSTweet" all notifications {"Alert"} default notifications {"Alert"} icon of application "Twitterrific.app"

end tell

end growlRegister

— Notify using Growl

— Example: growlNotify("This is an Alert","This is a test of the Growl Alert System")

on growlNotify(grrTitle, grrDescription)

tell application "GrowlHelperApp"

notify with name "Alert" title grrTitle description grrDescription application name "QSTweet"

end tell

end growlNotify

end using terms from

Advertisements