Re: Remove a Person from Address Book
Re: Remove a Person from Address Book
- Subject: Re: Remove a Person from Address Book
- From: Darwin Zins <email@hidden>
- Date: Wed, 12 Mar 2003 13:19:43 -0600
Hmm. I just tried that, but it doesn't actually delete the contact
from the Address Book. It doesn't error out or anything, it just
doesn't actually delete the contact.
Darwin
On Wednesday, March 12, 2003, at 12:45 PM, Andrew Oliver wrote:
You're calling:
remove aCard
The dictionary reference for 'remove' states:
remove: Remove a child object.
remove reference -- the object for the command
from reference -- where to remove this child from.
So if you use 'remove' you need to also be specific about where you
want to
remove it from. I have no idea what the appropriate values would be.
However, this appears to work for me:
delete aCard
Which seems to solve the problem.
On 3/12/03 9:47 AM, "Darwin Zins" <email@hidden> wrote:
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.
_______________________________________________
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.