Is there any script to Delete ALL web sites that contain and start with “https://www.facebook.com/profile.php” in the “I’M” field in all of Address Book cards in Address Book for Mac ? if not, can anyone help me in creating one ? new to script…
Without ANY guarantees! This might be worse than the illness! It was cooked in the fireplace in a used can.
Save an archive before.
tell application "Address Book"
repeat with p in every person
tell p
set todelete to {}
repeat with im in every AIM Handle
if value of im contains "https://www.facebook.com/profile.php" then
copy id of im to end of todelete
end if
end repeat
if todelete ≠{} then
repeat with td in todelete
delete AIM Handle id td
end repeat
end if
end tell
end repeat
end tell
Also this works on AIM handles, I am assuming that’s what you mean by “IM” field
@mouramartins Thank You so much for the script although I did a mistake. It was not the “AIM field” called “AIM Handle” in AppleScript but the “social media” field which I don’t know what is word for it. What should be changed instead ?
“url” is for the web sites field but the links as show in the picture are in the social media profiles field instead.
What is the proper term for social media profile in applescript ?
even better…what would be a script to delete all “social media links” in all fields in all cards ?
it seems that you can’t delete social profiles with AppleScript in Lion.
I tried (hopefully) every possible syntax.
Last try was
tell application "Address Book"
repeat with p in every person
repeat with i from 1 to (count social profiles of p)
if url of social profile i of p contains "https://www.facebook.com/profile.php" then
set profilID to id of social profile i of p
delete (1st social profile of p whose id is profilID)
end if
end repeat
end repeat
end tell
if you google for docs on tools for Address book at Apple Developer, tjem I guess something usable will show up, as the addressbook is used on their servers, as a centralized solution for contact managment, for their customers. So I guess, or think it is an admin tool for addressbook, and that may help you. But I guarantee zip!
Indeed it’s possible to manage all properties and elements with Objective-C but as the sample projects are created with pre-10.7 environment, none of the sample code provides access to the social profiles element.
As a workaround this script adds the people with a Facebook profile to a new group “facebook” in Address Book,
then you could delete the profiles manually
tell application "Address Book"
set filteredPeople to every person whose service name of social profiles contains "facebook.com"
make new group with properties {name:"facebook"}
repeat with aPerson in filteredPeople
add aPerson to group "facebook"
end repeat
save
end tell
Does that mean that all cards with facebook.com are being moved to the “Facebook” group and I will have to manually bring them back to their original groups ?