Regular readers will already know that I’m a big fan of Plazes. It is a service which, I think, deserves to have taken off more quickly.
The default Plazer application already integrates nicely with iChat, and will set my status to my current location. You can also get Applescripts that will enable other applications to do the same, for example Adium.
Last night, in a fit of interest, I hacked together my first ever Applescript. I recently read an article that described Applescript as “a hidden jewel in Apple’s crown”, and I have to say I was impressed. The blogging client I’m using, ecto, is scriptable – although I didn’t have anything to work from until I realised that the disk image had come with a bunch of example scripts, which I hastily installed for reference.
Making an XML-RPC call in Applescript is remarkably easy, and it was really simple to get hold of my current location – I used the Adium/Plazes script as an example, but the overall simplicity of the call really impressed me. After that, it was a straightforward matter of using an existing script that added text to the current draft to drop the location details into the post, and voila. The end of this post should demonstrate the capability.
I’ve uploaded the Applescript here.
- Open the script in a text editor.
- You will need to edit the script to put your Plazes username and password at the top. It will not work if you don’t do this.
- If you wish to change the text that the script adds to a post, alter the contents of the _text variable about three quarters of the way down (be careful though).
- Once you’ve made the changes, paste the script into the Script Editor and save it as Plazes.scpt, with a file format of script. The Script Editor should syntax highlight it all once it has been successfully saved as a script. Quit the Script Editor afterwards.
- Move the script to ~/Library/Application Support/ecto/Scripts.
- In ecto, choose Scripts->Plazes from the menu, and your location should appear in your current draft.
There’s one slightly frustrating feature of ecto – it apparently refuses to recognise the font-size style on the <p> tag and replaces it with lots of <span>s, and also replaces 10px with 10pt – not quite sure why that is yet.
Moving on from ecto, another interesting Plazes tool I’ve found is a Dashboard widget that displays a Google Map of your current location, and lets you find your contacts online. It is a bit rough around the edges, but I’ve been playing around with Apple’s new Dashcode tool and have tried making tweaks… I’ve dropped the author a line and hopefully he’ll want to resurrect it.
Posted whilst at White Leaf House [ plazes.com ]
Technorati Tags: adium, applescript, dashboard, ecto, location awareness, Mac, OS X, plazer, Plazes, scripting, widget, XML-RPC