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.
Published at 1:20 am on March 14th, 2003.
Topics: Mac Software
2 Comments
Was there any particular reason you were generating anchors with the person Id’s, or was that just an arbitrary way of massaging data for a dry run?
Comment by Mike Wasylik at 3:03 pm on August 11th, 2003 #link
Semi-arbitary! My thought was to eventually link each person in Address Book to their own page in a private Wiki. I chose the person ID because it looked like a unique field.
Comment by Tim at 3:17 pm on August 11th, 2003 #link