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


Click here to return to the 'Find duplicate Address Book entries via a script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Find duplicate Address Book entries via a script
Authored by: mark hunte on Mar 27, '06 11:07:27AM
Sorry But this Applescript may be better.
This script will Find the duplicate Entries in Your address book and put them into a New Group Called "Dupelicate Entries" Allowing you to easly 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
Written by © Mark Hunte - 2006 *)

tell application "Address Book"
	set biglist to {}
	set theGroup to count every person
	if not (exists (group "Dupelicate Entries")) then
		make new group with properties {name:"Dupelicate 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 "Dupelicate Entries"
		end if
	end repeat
	save addressbook
end tell

---
mh

[ Reply to This | # ]

Find duplicate Address Book entries via a script
Authored by: rusto on Mar 27, '06 05:04:01PM

Any reason you spelled "duplicates" as "dupelicates" in the script?



[ Reply to This | # ]
Find duplicate Address Book entries via a script
Authored by: mark hunte on Mar 27, '06 11:35:30PM

Nope, just Stupid... : )

Unfortunately you can not go back and edit silly spelling mistakes here.

---
mh



[ Reply to This | # ]
Find duplicate Address Book entries via a script
Authored by: mark hunte on Oct 03, '09 09:39:45AM
I had an email from dzg, letting me know this was broken in 10.6.
As far as I can tell its an odd bug. But a simplest fix is below.


(*
REVISED FOR 10.6
Details found at - 
http://www.macosxhints.com/article.php?story=20060322202753429
Written by © Mark Hunte - 2009*)

tell application "Address Book"
	set biglist to {}
	set theGroup to "Dupilicate Entries"
	if not (exists (group "Dupilicate Entries")) then
		make new group with properties {name:"Dupilicate Entries"}
		save
	end if
	set the_names to name of people
	repeat with i from 1 to number of items in the_names
		set theName to item i of the_names
		if theName is not in biglist then
			copy theName to end of biglist
		else
			set counter to (people whose name is theName)
			if (count of counter) > 1 then
				repeat with i from 1 to number of items in counter
					set this_item to item i of counter
					add this_item to group theGroup
				end repeat
				save
			end if
		end if
	end repeat
end tell

---
mh

[ Reply to This | # ]