Re: Address Book: Delete Person (still can't)
Re: Address Book: Delete Person (still can't)
- Subject: Re: Address Book: Delete Person (still can't)
- From: JimMain <email@hidden>
- Date: Wed, 21 Jan 2004 14:21:44 -0800
On Thursday, Jan 15, 2004, at 11:21 US/Pacific, Paul Berkowitz wrote:
On 1/15/04 10:00 AM, "JimMain" <email@hidden> wrote:
I've even tried:
tell application "Address Book"
activate
repeat with p in people
set l to (get label of AIM Handle of p) as string
You're not specifying _which_ AIM Handle. Many people will have NO AIM
Handles, so this will error. (Many errors in Address Book don't create
error
messages, they just waltz on without doing anything. There's a way of
forcing an error.) And otherwise, you either have to specify the first
AIM
Handle, if there is one, or do a repeat loop through all of them, if
you
want to catch every one, which I think you do.
Sorry, I was actually specifiying:
set l to (get label of AIM Handles of p) as string
...
(and at various times I had the 'save addressbook' step in there)
Regardless, my problem seems to be I can't manage to delete a person,
in any way, shape or form.
I took your script below, and simplified it to:
tell application "Address Book"
repeat with p in people
delete p
end repeat
save addressbook
activate
end tell
The above script still did not delete any entries from my Address Book.
I'm running OS 10.2.6 and Address Book 3.0.3 - I'm curious if anyone
else can get this to work in Jaguar, or have any other ways to remove a
person from the Address Book? I have to be able to run this script in
10.2.4 for my clients, upgrading to Panther isn't an option.
It may just be because you're neglecting to 'save addressbook' since
you
seem to be catching the first AIM Handle as if it were a property. How
about
if you quit Address Book and open it again - are they gone? Anyway,
this
should work:
tell application "Address Book"
repeat with p in people
set ll to (get label of every AIM Handle of p)
repeat with i from 1 to (count ll)
set l to item i of ll -- or AIM Handle i of p
if l contains "%X" then
tell p to make new phone at end of phones with
properties
{label:"delete", value:"delete"}
delete p -- ??
exit repeat
end if
end repeat -- AIM Handles
end repeat -- people
save addressbook -- !!!
activate
display dialog "Done!"
end tell
--
Paul Berkowitz
Jim Main
-------------------------------------------
619-948-5293
email@hidden
-------------------------------------------
_______________________________________________
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.