On Mar 28, 2009, at 2:40 AM, Chris Cairns wrote:

I came across a modified script for QS which when run displayed " .....minutes ago from Quicksilver" below the tweet instead of "....minutes ago from web (or TweetDeck/Twitteriffic or whatever)". I cant find it now. Anyone knows about it?

Here's the script I'm currently using (notice the set twitter_status line):

-- Original: http://blog.codahale.com/2007/01/15/tweet-twitter-quicksilver/
-- Improvements by various people working on this script
-- Dylan Verheul 2009-01-30: added encodeURL and length check

using terms from application "Quicksilver"
        on process text tweet
                my growlRegister()
                set tweetLength to count (tweet)
                if tweetLength is greater than 140 then
                        growlNotify("Tweet not sent", "Tweet is too long, 140 chars 
max!")
                else
                        tell application "Keychain Scripting"
set twitter_key to first Internet key of current keychain whose server is "twitter.com" set twitter_login to quoted form of (account of twitter_key & ":" & password of twitter_key)
                        end tell
set twitter_status to quoted form of ("source=qucs&status=" & encodeURL(tweet)) set results to do shell script "curl --user " & twitter_login & " -- data-binary " & twitter_status & " http://twitter.com/statuses/update.json "
                        
                        -- display dialog results
                        growlNotify("Tweet Sent", tweet)
                        
                        return nothing
                end if
                
        end process text
end using terms from

-- Do Growl stuff

using terms from application "GrowlHelperApp"
        -- Register Growl
        on growlRegister()
                tell application "GrowlHelperApp"
register as application "Tweet" all notifications {"Alert"} default notifications {"Alert"} icon of application "Script Editor.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 "Tweet"
                end tell
        end growlNotify
end using terms from

-- And finally, this handler makes text "URL-encoded" so that any text can be used with cURL

on encodeURL(someURL)
        return do shell script "/usr/bin/python -c '" & ¬
                "from sys import argv; " & ¬
                "from urllib import quote; " & ¬
                "print quote(unicode(argv[1], \"utf8\"))' " & quoted form of 
someURL
end encodeURL

Reply via email to