Address Book Duplicate Fixer

My address book (3000+) is a mess, after bad sync with Google, etc.

The built-in duplicate finder is useless. It only finds a few, if any, duplicates.

I tried Mark Hunte’s script (http://macscripter.net/viewtopic.php?id=16646),
which worked well to FIND the dupes, but I then I just end up with a list of 1200+ duped contacts;
I want to scriptically MERGE the dupes with each other.

The AB dictionary has no action to “Merge.”

How can I take the duplicates and make AB merge them automatically?

thanks

I am not at a Mac right now so as to see Address Book’s applescript dictionary, but if it does not have a ‘merge’ action, you’re probably going to have to do it yourself. Without a Mac, I can’t give you an AppleScript, but you should (using a repeat statement) take every contact as a list, then one-by-one you should find its duplicate, merge the data (using if statements to check which has which data and overwriting those of older data), delete both of the original entries, and then create a new entry with the data.

Hope this helps. :smiley:

Yes, but where you say ‘merge the data’ … that’s a big hairy ball of i-have-no-idea-how-to-do-that.

Most of the relevant info in address book is stored in the vcard property, which cannot be easily parsed, understood, or merged.

For example, a card with name ‘test’ and phone number ‘123’ – and no other data – appears to AS like this:


{modification date:date "Tuesday, May 12, 2009 12:08:59 AM", suffix:missing value, birth date:missing value, home page:missing value, vcard:"BEGIN:VCARD
VERSION:3.0
N:;Test;;;
FN:Test
TEL;type=CELL;type=pref:123
X-ABUID:37909C02-343D-4D9C-8EFA-919C57B95CA9\\:ABPerson
END:VCARD
", image:missing value, company:false, organization:missing value, note:missing value, creation date:date "Tuesday, May 12, 2009 12:08:35 AM", phonetic first name:missing value, first name:"Test", phonetic middle name:missing value, name:"Test", middle name:missing value, last name:missing value, maiden name:missing value, class:person, title:missing value, id:"37909C02-343D-4D9C-8EFA-919C57B95CA9:ABPerson", job title:missing value, nickname:missing value, department:missing value, phonetic last name:missing value}

It would take one heck of an applescript to merge two vcards.

Anyone??