Any script to delete specific website mentioned in "IM" fields in All?

The question is how the service name appears in the appropriate AppleScript property

Sorry but I didn’t get that. What do you mean ?

this line


 set filteredPeople to every person whose service name of social profiles contains "facebook.com"

expects “facebook.com” as the service name of a Facebook account, maybe the real name is different

I dont know if this helps or not. The values you’re looking at are in the class “ABMultiValue”. They won’t be referenced by a single Applescript descriptor. You’ll need to get the group (array) of items in the class ABMultiValue, then iterate through each item for each person record, looking for the value of the item. Then use “ removeValueAndLabelAtIndex: This might need to occur in ObjC.
StefanK, I think you are on the right track. Check out the XCode docs for ABMultiValue Class Reference

I know how to do this in ObjC. But it’s beyond the level of pure AppleScript

Thanks StefanK & SuperMacGuy

What would be the full recommended script then ?

Anyone else with AppleScript knowledge using Lion 10.7 can get this done ? PLEASE :slight_smile:

The possible ObjC solution isn’t AppleScript compatible

Pure AppleScript can’t do it, sorry

Someone said suggested the following in another forum:

tell application “Address Book”
repeat with thisPerson in people
set FBSocialProfiles to (every social profile of thisPerson whose service name contains “Facebook”)
if FBSocialProfiles ≠{} then
– has a facebook profile
add thisPerson to group “facebook”
end if
end repeat

save
end tell

On second thought, this might be somewhat faster. or it might not be. 

tell application “Address Book”
set FBSocialProfiles to (every person whose social profiles’s service name contains “Facebook”)
repeat with thisPerson in FBSocialProfile
add FBSocialProfiles to group “facebook”
end repeat
end tell

Any comments ?

Finally got this to work through some trial and error - not perfect by any stretch, but it does work. You can replace “Facebook” with the name of any other social network and it will remove those too. Apparently if you delete the url and user name, it will also nuke the whole social profile. Enjoy!


tell application "Address Book"
	repeat with thisPerson in people
		set SocialProfileList to (every social profile of thisPerson whose service name contains "Facebook")
		if SocialProfileList ≠ {} then
			-- has a social profile
			delete (url of every social profile of thisPerson)
			delete (user name of social profile of thisPerson)
		end if
	end repeat
	save
end tell

Thanks a lot for your efforts. Getting “missing value” again.

I got that too, but it still worked. Try running it again.

The ‘missing value’ is probably the result of the ‘save’ command at the end. Nothing to worry about it it is.

Secondly, would you mind not “top posting” on these forums?