Re: Remove a Person from Address Book
Re: Remove a Person from Address Book
- Subject: Re: Remove a Person from Address Book
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 12 Mar 2003 12:33:12 -0800
Could that be because you may have set 'aCard' to 'properties' of the
person, rather than the person? Worst come to worst just spell it out
set theID to ID of aCard
delete person id theID
but you shouldn't have to do that. If you have a separate variable set to
the person, not the properties, just
delete thePerson
Again - in a tell block to Address Book, no interior tell blocks.
--
Paul Berkowitz
>
From: Darwin Zins <email@hidden>
>
Date: Wed, 12 Mar 2003 13:19:43 -0600
>
To: <email@hidden>
>
Subject: Re: Remove a Person from Address Book
>
>
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.
_______________________________________________
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.