omer bar-or · The Plan Askew · New Version of Address Book Test Program

New Version of Address Book Test Program

Written: June 14th, 2007, 20:23 (UTC) By: omer 2 comments

As an update to this post on working with the Mac OS X Address Book, I now have another deliverable: a program that prints all of the properties available on the address book. It's still only printing ASCII, and it's not in the correct format to be imported into OOo as a text file, but these issues are hopefully not hard to fix, and since they don't actually involve the Mac OS X Address Book API, I'm not sure that I'll actually take those final steps. I'm also not yet handling groups (the Mac OS X Address Book is split into two databases: groups and people), which is a more important lack and one that I will likely spend some time exploring soon. Anyway, the tarball for the program is available here. A brief description follows.

Basically: the the most important parts of the program are two method, one called printInformationForRecord and the other called getStringRepresentationOfPropertyValue. The former (by using the latter) can print any property in the address book (at least any one that I've been able to create so far). It doesn't assume that it is working with people, though I haven't tested it with groups yet. The latter can turn any type of value into a string (with the exception of "data" values, which are basically byte arrays and thus could be storing any kind of data), where the types are any of the ones listed in Apple's list of possible types. Although these methods only print a property to STDOUT, they are general enough that only a few manipulations would be enough to get them to do more complex things. This might even become the skeleton for handling the Mac OS X Address Book in OOo, though the complexity of OOo code will likely prevent that.

P.S. Thanks to Florian Heckl for correcting errors in the original program that helped me make this new one!

File: abpeople.tar

Comments

  1. minor correction

    Written: June 15th, 2007, 7:01 (UTC) By: Florian Heckl [e-mail: florian@florian-heckl.de] permalink

    Hi Omer,

    this time just one minor correction: in getStringRepresentationOfPropertyValue(CFTypeRef _propertyValue) you should return an empty string instead of null or check for null where you use the method. Your version crashed with my first record already. Changing the default return value made it run completely through my addressbook. Good work.

  2. re: minor correction

    Written: June 15th, 2007, 8:03 (UTC) By: omer [www] [e-mail: omer [dot] baror (at) gmail [dot] com] permalink

    Thanks for the correction, Florian. I'd meant to change that return after reading your comments on my other program's ignoring of nulls but apparently missed it. The version with that correction is uploaded.

Leave a comment

Color scheme: