I accidentally added about 600 contacts to my Mac address book from a friend’s iPhone I synced to my Mac a couple weeks ago. Unfortunately, I don’t have a backup of my contacts and now they are all synced with my iPhone and iCloud.
I was able to export all the unwanted contacts as “.VCF” files from my friends phone so I have about 600 files like “John Doe.vcf” and also a plain text list of just the contact names.
I would like a script that automatically deletes the matching name in the list from my address book, skipping the searches that return two or more results (that way I don’t lose my own contacts with same name as my friend’s)
I started by attempting to delete a single contact using the following AppleScript but with no luck. Any help would be appreciated. THANKS!
set daName to "John Doe"
tell application "Contacts"
repeat with onePerson in people
if (value of name of onePerson) is daName then
delete onePerson
end if
end repeat
end tell
Model: iMac
AppleScript: 2.8.1
Browser: Safari 537.36
Operating System: Mac OS X (10.10)