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 :

#!/bin/bash
security -q find-internet-password -gs twitter.com 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 “user@domain.com”
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.


Keychain scripting letting the Twitters down

March 23, 2007

So posting to Twitter from Quicksilver is great and all, except when keychain scripting times out on you – “event timed out”. Again and again. Sheesh. Off to look for another way around …

Red Sweater Blog says :

Obviously, Keychain Scripting is freaking useless. I decided to take a stab at writing my own […]

Which is just what he did – in that article you can find a Scripting Addition (of sorts) that is way faster than Apple’s one. However it is 10.4 only, which may be the straw that broke this holdoff-on-upgrading-a-while-longer’s back.

Looking further afield leads us to the Textmate blog, where a shell based approach is used to interact with the keychain :

The command to access the keychain is security and it has a manual page. But let me save you some time and give you the gist of it […]

Aha! That may be the solution. Now all I have to do is find out how to parse the output to just grab the password – the solutions on that page aren’t working for me and my shell scripting is more limited than I would like.

Still diggin!


The internet is all a Twitter

March 22, 2007

Latest fad or long term tool? I have no idea, but with all the talk about Twitter I finally caved in and registered.

http://twitter.com/aDogsBreakfast

Perhaps it was Dave Winer jumping in that tipped the balance, or perhaps when I learned that people were posting from QuickSilver that did it. No matter really, now I am in. What next?

Well I had to get th QuickSilver posting working, and as I’m still running Panther (10.3) that means I’m also on a legacy version of QuickSilver (b36) – and that means the Tweet script as modified wasn’t quite going to work the same.

Whoa – slow down. The problem was that my QuickSilver install didn’t have the ‘Actions’ folder there under /Library/Application Support/Quicksilver – so I just created the folder, dropped the Tweet script in and everything is working.

A happy side effect is that I have now had my first ever successful scripting experience with the keychain application – I just never managed to get the syntax correct until now. That is the challenge I always have with Applescript 🙂

[edit : I’ve changed my Twitter name to be more sms-friendly follow my tweets now at twitter.com/aDB]


Quick passwords

July 16, 2006

I’m installing a new WordPress blog as part of the migration of my hosting business. Naturally the need for fresh passwords arises, and I wanted to finally automate that tedious ‘creative’ process.

Digging around for some solutions I eventually end up on wincent.com with a quick article on installing a utility called ‘pwgen‘ – a small, GPL’ed password generator which creates passwords which can be easily memorized by a human. Knowledge base: Building pwgen on Mac OS X 10.3 All is good so far, this looks like a great little tool. (p.s. It is up to v2.05 now, still installs smoothly on 10.3)

However I wasn’t satisfied. I needed a nice default and I wanted a new password to be as close as possible. That lead me to build the solution in Quicksilver. How to do this? Well a quick AppleScript later I have a solution – then I bind the script to a QuickSilver trigger and a new password is only a keystroke combo away!

Open this script in a new Script Editor window. (Sorry this isn’t working – WordPress seems to be stripping out the applescript: part of the URL.)


set newPass to do shell script “/usr/local/bin/pwgen -cny 8 1”
set the clipboard to newPass
tell application “Quicksilver”
show large type newPass
end tell

[Updated to note the failure to fix the link to the ApleScript]


New AppleScript Training

July 15, 2006

Here’s a new AppleScript training course – with a few chapters freely available. Maybe these will finally help me get the hang of this powerful, but for some (like me) frustrating tool.

Automated Workflows, LLC – AppleScript and Workflow Automation Consulting


Applescripting the Network Preference Pane

February 21, 2005

OK – here’s a nugget of information that I’ve had to search for twice now, so here I’m going to preserve it for a while.

The problem I was trying to solve was using Applescript to change the network in OS X – the path I initially took was to try GUI scripting the Network Preference Pane, but it is problematic, tricky and just plain difficult to get working. Not to mention inelegant and prone to breaking.

Eventually I stumbled across the answer – try doing it from the command line instead! The command to use is ‘scselect’ as told by John Welch on the Applescript Users mailing list one of Apple’s mailing lists.

So you would use the command ‘do shell script’ to use the ‘scselect’ utility from Applescript.


Life, the universe etc…

May 3, 2002

Found another little gem, http://www.brooklinesoftware.com/webminer/webminer.html called webminer. This allows Applescripts to “[…] open web pages, download content, submit forms and retrieve results.” Cool.