Have you ever wondered how OSX decides what email address to use when you email a contact? A lot of the time, you get to choose, but there are times when the system decides for itself... Such as when you are using iCal to send out event invitations.
There is actually a way that the system decides on which address to pick, and this is even a public API. The problem though, is that Address Book does not expose this interface to the user.
So, after some researching (to find the actual way this is implemented), I developed a small (command line) tool to change the default email address for a user. This tool, takes the form of a small python program, using the pyobjc bindings to the AddressBook framework.
The source code is avaliable from my repository in the stuff repository under the osx/addressbook/edit_default_address.py path.
You will also find in the same folder: a script to create a mutt alias file from the system address book, and a script to convert all of the phone numbers into the international format (from the Australian format).
These three programs form the basis of a good set of examples of the python objective-c bridge for the AddressBook format.
No comments:
Post a Comment