Remove a Person from Address Book
Remove a Person from Address Book
- Subject: Remove a Person from Address Book
- From: Darwin Zins <email@hidden>
- Date: Wed, 12 Mar 2003 11:47:18 -0600
I have this code:
-- Remove any Entries in Apple Address Book that are not in Zaurus
Address Book
tell application "Address Book"
repeat with aCard in every person
set found_in_z to false
set a_first_name to first name of aCard as string
set a_last_name to last name of aCard as string
repeat with anItem in XML contents of theXML
if XML tag of anItem is equal to "Contacts" then
repeat with zCard in XML contents of anItem
try
set z_first_name to |FirstName| of XML attributes of zCard as
string
on error
set z_first_name to ""
end try
try
set z_last_name to |LastName| of XML attributes of zCard as
string
on error
set z_last_name to ""
end try
if a_first_name = z_first_name and a_last_name = z_last_name then
set found_in_z to true
exit repeat
end if
end repeat
end if
end repeat
if found_in_z is false then
tell me to display dialog "Removing " & a_first_name & " " &
a_last_name
remove aCard
end if
end repeat
When it runs I get this error: "Address Book got an error:
NSCannotCreateScriptCommandError"
How do I tell the Address Book to delete this person?
Thanks,
Darwin
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.