Group Duplicated AddressBook enteries.

I posted this in response to a hint on Macosxhints.
http://www.macosxhints.com/comment.php?sid=20060322202753429

The script will Find the duplicate Entries in Your AddressBook.app and put them into a New Group Called “Duplicate Entries” Allowing you to easly compare and edit them.) ***NOTE: The script will ADD a NEW GROUP IN YOUR ADDRESS BOOK : NAMED “Dupelicate Entries” if it does not exist:

 (*
Details found at - http://www.macosxhints.com/comment.php?sid=20060322202753429
or
http://bbs.applescript.net/viewtopic.php?id=16646

Written by © Mark Hunte - 2006 *)

tell application "Address Book"
	set biglist to {}
	if not (exists (group "Duplicate Entries")) then
		make new group with properties {name:"Duplicate Entries"}
	end if
	set the_names to the name of every person as list
	repeat with i from 1 to number of items in the_names
		set this_Name to item i of the_names
		set theName to name of person this_Name as string
		if this_Name is not in biglist then
			copy this_Name to end of biglist
		else
			add (people whose name is theName) to group "Duplicate Entries"
		end if
	end repeat
	save addressbook
end tell

I’m a little cautious about suggesting this, Mark, but this is a tad crisper:

EDIT: Crisper, maybe, but this doesn’t work! Use Mark’s version above

(*
Details found at - http://www.macosxhints.com/comment.php?sid=20060322202753429
or
http://bbs.applescript.net/viewtopic.php?id=16646

Written by © Mark Hunte - 2006 *)

tell application "Address Book"
	set biglist to {}
	if not (exists (group "Duplicate Entries")) then
		make new group with properties {name:"Duplicate Entries"}
	end if
	set the_names to the name of every person
	repeat with i from 1 to count of the_names
		tell item i of the_names
			if it is not in biglist then
				copy it to end of biglist
			else
				copy (person whose name is it) to (group "Duplicate Entries")
			end if
		end tell
	end repeat
	save addressbook
end tell
end

Also, in the Card menu of the Tiger Address Book, there’s an entry: “Look for duplicate entries…” I don’t have any duplicates, so I don’t know how what it does compares to your script.

Don’t be it all helps.

It probably could be made crisper. But it only takes a about 10 seconds for 259 entries.
(20 seconds if your looking at the Event log)

Unfortunately your adjustments breaks the script.

Bet you did not test it on any dupes.

The Find dupes in AB only asks if you want to merge them, it does not show you what the differences are
or tell which ones they are.

Sorry for the screwup, thanks for the explanation. I’ve marked my post.