Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'An AppleScript to remove Address Book duplicates' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript to remove Address Book duplicates
Authored by: Dave Creek on Dec 07, '05 11:07:56AM

This script is exactly what I want, but...

Could you modify it so it does not select entries that have both the first and last name blank? That way entries that have a company name listed but don't have a person listed would not show up in the "doubles" group.



[ Reply to This | # ]
An AppleScript to remove Address Book duplicates
Authored by: kupietz on Feb 01, '06 09:10:51PM
Here's a version that considers all contact info fields that would be included in a vCard, instead of just the name fields. I'm not sure what exact fields are considered, I know the Notes field isn't but other than that it only found records that were complete field-for-field duplicates of other records in my Address Book. Make sure you comb through to check that you aren't deleting any important notes before you delete records. You still need to create an empty group "Doubles" in your address book before running this.
set liste to {}
set avirer to {}
tell application "Address Book"
	with timeout of 3200 seconds
		set code to ""
		repeat with this_person in every person --of group "bidule"
			set full_name to vcard of this_person as string
			if full_name is in liste then
				set lid to this_person's id
				set avirer to avirer & lid
			else
				set liste to liste & full_name
			end if
		end repeat
		repeat with une in avirer
			set bla to person id une
			set lenom to name of bla
			add bla to group "Doubles"
			save addressbook
		end repeat
	end timeout
end tell
Thanks to the original author and other contributors, this saved me a bunch of time.

[ Reply to This | # ]
An AppleScript to remove Address Book duplicates
Authored by: kupietz on Feb 01, '06 10:14:50PM

One note: I'm not sure because I didn't keep tabs on exactly what I did, but it seems like if you delete all groups except "All", comparing vCard attributes finds more duplicates than if you have people in several groups. I'm not clear on this whole vCard thing.

Mike



[ Reply to This | # ]