The script in its current state will not work. I plan on updating it once 
my wiki account is verified, but until then here it is below:

Note: This script utilizes keychain scripting which is only in Snow Leopard 
(10.6) & below. If you use Lion or above, the "twitter_login" variable must 
be hardcoded into the script, similar to the current version posted 
(username:password). ie: (set twitter_login *to* quoted form *of* 
"username:password"). 
I believe his security issue can be circumvented using Daniel Jalkut's 
"Usable Keychain Scripting For Lion" 
http://www.red-sweater.com/blog/2035/usable-keychain-scripting-for-lion, 
but I don't have a Lion box to test it out on.

I've also added a few things:
- Growl integration for success/failure
- Character counter (will growl you if the tweet is too long)
- Better character encoding (python function to help prevent false 
positives).

I don't take any credit for any of this, they're all functions copy-pasted 
& groomed from other sources.

(* Start of Script Below *)

*using terms from* *application* "Quicksilver"

*on* *process text* tweet

*set* wordcount *to* *do shell script* "echo " & quoted form *of* tweet & " 
| wc -m"

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

# Set to 142 instead of 140 to take into account the quotation characters

*if* wordcount *as* *integer* > 142 *then*

*set* countText *to* "(" & wordcount & ") characters"

*my* growlRegister()

growlNotify("Tweet Too Long", countText)

*return* nothing

*end* *if*

*set* tweet_encoded *to* urlencode(tweet)

*tell* *application* "Keychain Scripting"

*set* twitter_key *to* *first* *generic key* *of* current keychain *whose* 
name *is* "SuperTweet"

*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&lat=21.510625&long=-157.969311&status=" & tweet)

*)

*set* twitter_status *to* quoted form *of* ("source=qucs&status=" & 
tweet_encoded)

*set* results *to* *do shell script* "curl --user " & twitter_login & " 
--data-binary " & twitter_status & " 
http://api.supertweet.net/1.1/statuses/update.json";

-- display dialog results

*my* growlRegister()

growlNotify("Tweet Sent", tweet)

*return* nothing

*end* *process text*

*end* *using terms from*


*using terms from* *application* "GrowlHelperApp"

-- Register Growl

*on* growlRegister()

*tell* *application* "GrowlHelperApp"

*register* as application "TweetSilver" all notifications {"TweetSilver"} 
default 
notifications {"TweetSilver"} icon of application "QuickSilver"

*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 "TweetSilver" title grrTitle description grrDescription 
application 
name "TweetSilver"

(* image from location "/tmp/spotify-artwork.tiff" *)

*end* *tell*

*end* growlNotify

*end* *using terms from*


*on* urlencode(theText)

*return* *do shell script* "/usr/bin/python -c 'import sys, urllib; print 
urllib.quote(sys.argv[1])' " & quoted form *of* theText

*end* urlencode

                (* End of Script *)

On Tuesday, January 29, 2013 4:57:54 AM UTC-8, Patrick wrote:
>
> Your best bet is probably the Twitter AppleScript, see here: 
> http://qsapp.com/wiki/SuperTweet_(AppleScript)
>
> There is a plugin that somebody has made, but it's not fully functioning.
> https://github.com/migrs/QSTwit
>
> On 29 January 2013 12:52, n=1 <[email protected] <javascript:>> wrote:
>
>> I'm not referring to controlling a twitter app, but rather tweeting 
>> directly from the QS interface. Google Quick Search Box did this for a time 
>> on mac, but I'm not aware of anything like this now. Can QS do it? Thanks! 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Quicksilver" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/blacktree-quicksilver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to