Mark Pilgrim just posted LazyWeb request for some Address Book Features. Well, I’ve been messing around with the Address Book in MacOS X recently. We needed something to store a load of addresses and also add some sort of annotations to them (last contacted on xxxx-xx-xx:xx:xx:xx etc.) We also needed something with a simple UI for inputing data and syncing to PalmOS devices. It’s not ideal, but Address Book and Applescript seem a good start. I’ve not looked at Applescript for a few years but within 15 minutes my feeble brain came up with this script:
on listAddressBook() set resultText to "" tell application "Address Book" repeat with groupIndex from 1 to the count of groups set theGroup to group groupIndex set resultText to resultText & the name of theGroup & return repeat with x from 1 to the count of people of theGroup set thePerson to person x of theGroup set resultText to resultText & my getLink(the name of thePerson, the id of thePerson) & return end repeat end repeat end tell return resultText end listAddressBook on getLink(linkText, href) return "<a href="" & href & "">" & linkText & "</a>" end getLink on showResult(theString) tell application "BBEdit" make new window set selection of window 1 to theString end tell end showResult showResult(listAddressBook())
It’s just a proof-of-concept to make sure we weren’t wasting time entering into Address Book. It should be easy to massage the data for many different purposes.