|
|
An AppleScript to remove Address Book duplicates
If you have entries from companies that don't have any person listed in them, they also get deleted. For instance, I have a card for my local record store, but I don't know the name of the guy who works there, so I never put it in. This entry got deleted with this script. Fortunately I had a backup.
I changed the script around to dump all the doubles it finds into a group named "doubles", so you can go through by hand and delete. I know less than anything about writing applescripts, so you have to create a group named "doubles" before you run this script.
An AppleScript to remove Address Book duplicates
I am running 10.2.8.
An AppleScript to remove Address Book duplicates
This script is exactly what I want, but...
An AppleScript to remove Address Book duplicates
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.
Thanks to the original author and other contributors, this saved me a bunch of time.
An AppleScript to remove Address Book duplicates
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.
An AppleScript to remove Address Book duplicates
Here's a variant of the script that
--
-- A script to look for duplicate cards in the Address Book
-- It looks for identical names, companies and emails
-- As distributed it requires identical emails,
-- or identical first,middle and last names plus company name to be considered identical
-- Simply comment out the code associated with an attribute to remove it from consideration
-- If multiple emails are associated with a card then the first one is considered canonical.
--
-- The script is a modification of the script authored by Safar
-- http://www.macosxhints.com/users.php?mode=profile&uid=1000517 and http://www.etincelle.org/
-- I have kept the French variable names, and added my English ones (ONE world!)
--
-- Version 13. SM 20070714
--
property duplicate_group_name : "Doubles"
property automatic_move : true -- the default and automatic action is to move the possible duplicates to the group with the name given by duplicate_group_name
display dialog "The name of the group to collect possible duplicates" default answer duplicate_group_name
set duplicate_group_name to text returned of result
display dialog "Should identified duplicates be moved to " & duplicate_group_name & " automatically?" buttons ["yes", "no"] default button 2
if (button returned of result is "yes") then
set automatic_move to true
else
set automatic_move to false
end if
set liste to {}
set email_liste to {}
set avirer to {}
tell application "Address Book"
with timeout of 3200 seconds
set code to ""
if not (duplicate_group_name is in name of every group) then
set duplicate_group to make new group with properties {name:duplicate_group_name}
else
set duplicate_group to every group whose name is duplicate_group_name
end if
repeat with this_person in every person -- of group "PossibleDuplicates"
-- Comment out the components you don't want to test on
set full_name to ""
set first_name to first name of this_person as string
if first_name = "missing value" then set first_name to ""
set full_name to full_name & first_name
set middle_name to middle name of this_person as string
if middle_name = "missing value" then set middle_name to ""
set full_name to full_name & middle_name
set last_name to last name of this_person as string
if last_name = "missing value" then set last_name to ""
set full_name to full_name & last_name
set this_email_list to properties of emails of this_person
try
set this_email to value of item 1 of this_email_list
on error
set this_email to ""
end try
set full_name to full_name & this_email
set this_company to company of this_person as string
if this_company = "false" then set this_company to ""
set full_name to full_name & this_company
if (full_name > "" and not (full_name = "true")) then
if full_name is in liste then
if automatic_move = false then
-- check the user's preference
display dialog ("Possible duplicate (name): " & first_name & " " & middle_name & " " & last_name & " " & this_company & " " & this_email) buttons ["ignore", "move to " & duplicate_group_name, "Cancel"] default button 2
if button returned of result is ("move to " & duplicate_group_name) then
set lid to this_person's id
set avirer to avirer & lid
end if
else
set lid to this_person's id
set avirer to avirer & lid
end if
else
set liste to liste & full_name
end if
else if (this_email > "") then
if this_email is in email_liste then
if automatic_move = false then
-- check the user's preference
display dialog ("Possible duplicate (email): " & first_name & " " & middle_name & " " & last_name & " " & this_company & " " & this_email) buttons ["ignore", "move to " & duplicate_group_name, "Cancel"] default button 2
if button returned of result is ("move to " & duplicate_group_name) then
set lid to this_person's id
set avirer to avirer & lid
end if
else
set lid to this_person's id
set avirer to avirer & lid
end if
else
set email_liste to email_liste & this_email
end if
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 duplicate_group_name
end repeat
save addressbook
end timeout
end tell
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.05 seconds |
|