Hello,
I have had this script for a while, but it stopped working since Snow Leopard or address book updates.
It develops the following error:
error “Address Book got an error: every person doesn’t understand the remove message.” number -1708 from every person
Any help would be very much appreciated. I have researched and cannot figure out a resolution!
Thanks in advance for any help.
OS 10.6.6
Address Book Ver 5.0.3
Script Editor ver 2.3
The full code is below:
on replaceString(theText, oldString, newString)
set AppleScript's text item delimiters to oldString
set tempList to every text item of theText
set AppleScript's text item delimiters to newString
set theText to the tempList as string
set AppleScript's text item delimiters to ""
return theText
end replaceString
tell application "Address Book"
set theGroups to every group
end tell
repeat with aGroup in theGroups
if id of aGroup contains "ABSmartGroup" then
set theName to "_" & replaceString((name of aGroup), "SM_", "")
tell application "Address Book"
if group theName exists then
remove every person from group theName
else
make new group with properties {name:theName}
end if
add (every person in aGroup) to group theName
end tell
end if
end repeat
tell application "Address Book" to save