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 17:35:29 -0600
Well, I thought it was working, but I tried it again and it does not
work. This is the 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
exit repeat
end if
end repeat
if found_in_z is false then
tell me to display dialog "Removing " & a_first_name & " " &
a_last_name
delete aCard
end if
end repeat
end tell
tell application "Address Book" to save addressbook
The dialog comes up saying it is going to delete the entry, but it
doesn't get deleted. I quit the script editor and quit the addressbook
and then opened it back up, but the person it said it deleted was still
there. I am not setting aCard to the properties of the person in this
case.
This should work, shouldn't it?
Thanks,
Darwin
On Wednesday, March 12, 2003, at 03:43 PM, Darwin Zins wrote:
>
Yes, that was the problem, but I have seen it delete people while I
>
was watching, but this time I had to close the AB and re-open it, then
>
that entry was gone.
>
>
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.