Getting Birthdays out of the AppleAddressBook
Thursday, October 2nd, 2008Recently I posted a terrible piece of AppleScript, but I refurbished the whole thing and rewrote it in python.
Basically there are two known ways of accessing the contents of the Apple AddressBook - well, two sane ways.
The first and most simple one is to use SQLite, and that will doubtlessly be the fastest way. But if Apple ever changes the data-schema of the addressbook the script will be useless. Apart from all that, there is another, more interesting way of accessing the addressbook - so I took the long way home *g*.
PyObjC offeres a neat bridge to OSxs’ native methods - these methods are useable in Python. Using pythons datetime classes it is pretty simple to accomplish almost anything concerning dates. This blog-entry was a great help and gave me the idea to use PyObjC - thanks!
Since my OSX does not offer a py2applet (and the macports version does not work properly) I used Platypus to bundle it into an App.
The Growl code I used stays BSD-licensed, my code is GPL3.
Have fun (and post improvements).