Duplicate Address Book entries search using AppleScript

For quite sometime now I’ve been struggling with lots of duplicate entries in my Address Book, that was a result of – 
  • Syncs from Treo to BB and then to iPhone. 
  • Syncs from .mac, my trusty companion since 2005 – PB-G4-12″, intel Mac and a MacBook from’03. 
  • Syncs of contacts from LinkedIn, Yahoo and GMail on a regular basis. 

Believe it or not, there are so many places you end up creating contacts that after a while it becomes really cumbersome to manage contacts. Finally, as a weekend project I decided to get rid of duplicates – and here’s an interested script that I came across – that allowed me to sift through duplicates while not deleting them right away.  Hope this helps everyone out, though you can easily find the script on Mac OS X Hints as well.  Having a built-in feature within Address Book to deal with this issue would certainly help – or better yet within iPhone itself. 

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”}
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
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
end if
end if
end repeat
end tell

Leave a Reply

Your email address will not be published. Required fields are marked *

Manoj Khanna
© 2024 Manoj Khanna