I write this blog from an unaccustomed place: Apple’s TextEdit application. That I’m doing it from a text processor isn’t in and of itself unusual; normally I write my blog in BBEdit before uploading it to the web. The unusual part is that this blog will be published to the web without my opening a web browser.
This is what I started writing about in July when Apple quietly announced that they would make support for web services–web applications that can be addressed using either XML-RPC or SOAP–available in the operating system and accessible via AppleScript in Mac OS X 10.1. Yesterday I wrote a short AppleScript (available for download) that uses SOAP to call web services belonging to Manila, the publishing system that hosts this blog. The script takes the content of the topmost TextEdit window and makes it a story on my website.
Apple’s made web services pretty darn easy to use. You specify the URL you’re going to and the location of the command you want to use, and the parameters that it takes. You execute the SOAP call. You can call out elements of the resulting XML result by name as though they were normal AppleScript properties (enabling me to get the message number that results when the story is posted).
What’s not to like? Well, sometimes if the script you’re writing doesn’t work, it’s hard to figure out whether you’ve made an error, whether something has gone wrong on the other end, or something else entirely. Case in point: I was getting error messages yesterday from Manila complaining I hadn’t supplied enough parameters to create a message. Had I missed something? Had Dave added something? Then I looked at the XML output (using a great tool from one of Apple’s scripting guys) and realized that the password element had been dropped out. On a little digging, the same Apple guy tipped me off that “password” has a special meaning in AppleScript and I had to treat that property differently (see the script source).
Okay, not perfect, but still having fun. What’s next? How about tying a spellchecker into the workflow? Ease of use capabilities like saving username and blog address, and keychain support, and other applications, and…
I better not get ahead of myself.
The subtitle is taken from Guru’s jazz/hip-hop album, Jazzmatazz. It’s a duet with MC Solaar, French hip-hop artist, in which Solaar basically shows Guru up as a rapper of inferior skills. But I don’t think he knew that when he recorded it. 🙂
Larry responded to my piece to point out that he’s done this between TextEdit and Blogger. There are probably other people out there doing this too. Let’s have a scripting-our-blog party!