Twitter from QuickSilver on Panther solved – avoid keychain scripting

March 28, 2007

Phew. Finally I’ve made it through and (having re-learned a few things on the way) can now Tweet (is that the verb to use in this case?) from QuickSilver.

You may remember, from last time, that the principal stumbling block was Apple’s Keychain Scripting application – which frankly is unusable for those of us with more than a few items in our keychains.

The Textmate blog then put us on the trail of Apple’s command line tool for maniplulating the keychain. Further investigations turned up a recent posting from Extra Pepperoni on the topic, with a very informative first comment that is a must read. That comment then pointed to an Apple mailing list, CDSA (Common Data Security Architecture.)

So what, exactly, is the solution? Well at the moment it is a bit on the hardcoded hack side of things, but it does work for me. The calls to the app “Keychain Scripting” are replaced by a shell script :

security -q find-internet-password -gs 2>&1 | grep password | \
  sed -e "s/password: \"//" -e "s/\"//"

Save that into a text file, perhaps in ~/bin (which you’ll probably have to create.) I chose to call it ‘twitpass.’ Remember to set it to executable …

chmod 755 twitpass

will do the job nicely. Now you can call that script from the AppleScript to get your pasword. Unfortunately I still can’t seem to parse the bulk of the output from security, so you’ll have to hard code your account name or email address into the AppleScript, replacing the tell application “Keychain Scripting” block with something like this:

set twitter_key_account to “”
set twitter_key_pass to do shell script “~/bin/twitpass”
set twitter_login to quoted form of (twitter_key_account & “:” & twitter_key_pass)

So using the above components in the mix of yesterday’s solution and you can Tweet to your heart’s content, without leaving the application you’re working on.