I have a bunch of email addresses in my contacts that are the email addresses of their phone number provided to them from Verizon.
For example:
1234567890@vtext.com or
I want to create an Applescript that deletes all of those email addresses.
I have a bunch of email addresses in my contacts that are the email addresses of their phone number provided to them from Verizon.
For example:
1234567890@vtext.com or
I want to create an Applescript that deletes all of those email addresses.
I haven't tried pbell's answer, but the script below worked for me.
tell application "Contacts"
tell every person
delete (every email whose value contains "vtext.com")
end tell
save
end tell
you cannot directly select all Id's of all emails of all persons, you need to loop through persons and, in each, get emails which contain your pattern.
Script bellow is working. I just add a selection criteria (for my tests) which selects all persons whose name are "tests". Delete this row and remove the "--" on next row if you want to go through all your contacts.
Last, but not least, because you may delete many data, make sure you've backup all you contact database before !!
tell application "Address Book"
set All_Contacts to every person whose name contains "tests"
--set All_Contacts to every person
tell me to display dialog "Are you sure you want me to check emails of " & (count of All_Contacts) & " contacts ?"
repeat with My_Contact in All_Contacts
set Bad_Id to (id of every email of My_Contact whose value contains "vtext.com")
repeat with my_Id in Bad_Id
delete (emails of My_Contact whose id is my_Id)
end repeat
end repeat
save
end tell