I would like to be able to run a script which would look through my Contacts list and output the name (and, preferably, phone number) of anyone whose ‘Anniversary’ date matches today. (The script should be something I can run on OS X 10.9 and output to stdout.)

I can do the same for birthdays using the contacts command from http://www.gnufoo.org/contacts/contacts.html (or brew install contacts) but it does not do the same for addresses.

I found a Mac OS X Hints post which suggested that it might be able to work via sqlite3 but I have not been able to get that to work. (Which isn’t to say that it can’t be done, only that I haven’t been able to do it.)

It occurs to me that someone might have already invented this particular ‘wheel’ and I am just not aware of it. Other than the two links above, Google has not been particularly helpful.

  • Calender does that (as contacts birthdays) , so does skype so do others.. – Ruskes Jul 7 '14 at 17:44
  • Yes, but that doesn’t help me get the output into a script, which is what I need. – TJ Luoma Jul 7 '14 at 17:45
  • you probably have to export it first: subclassed.com/apps/export-address-book/support – Ruskes Jul 7 '14 at 22:29

Looking at the database being opened by that SQLite snippet in Navicat I don't see any data there; I would assume that the iCloud move caused some changes but perhaps I am not viewing it right.

If you have a developer account you might look in the documentation for Address Book programming. There's pretty rich support for searching and I would be shocked if you couldn't look for matching dates. Anniversaries seem to not have their own distinct type - there's a property constant for kABBirthdayProperty but nothing like Anniversary, so it presumably falls under kABOtherDatesProperty.

Dates associated with a person (ABMultiDateProperty containing dates).
Available in OS X v10.3 and later.
Declared in ABGlobals.h.

And sure enough, there's an identifier (seemingly the only pre-provided identifier) for other dates.

Other Dates Labels Labels for values contained in ABOtherDatesProperty multi-value properties.

kABAnniversaryLabe l
Anniversary date.
Available in OS X v10.3 and later.
Declared in ABGlobals.h.
Available in OS X v10.3 and later.

I imagine this sub-listing is why the command line app you reference doesn't spit out anniversaries; it would need to be cognizant of the possibility of other date types in that "other" category. But I would think it could be extended to handle them (if it still works?)

Given the above you might see if you can write a simple Swift app to spit out all entries with anniversaries. You can do command line apps with it. Applescript won't help you - the Contacts as interface doesn't seem to share out other type dates.

  • Thanks, Don. BusyCal pulls together an “Anniversaries” calendar somehow, so it must be possible, although who knows what they are doing to make it work. – TJ Luoma Jul 9 '14 at 17:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .