Re: Setting 'group' for person in Address Book....
Re: Setting 'group' for person in Address Book....
- Subject: Re: Setting 'group' for person in Address Book....
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 23 May 2005 13:16:28 -0700
- Thread-topic: Setting 'group' for person in Address Book....
On 5/23/05 12:02 PM, "Michelle Steiner" <email@hidden> wrote:
>
> This works also:
>
> tell application "Address Book"
> set the_person to person "Sharon Steiner"
> remove the_person from the_person's groups
> add the_person to group "Family"
> end tell
Does that really work when the person has more than one group, or is Address
Book just resolving 'groups' to a single group when there's only one? (I.e.
coercing a single-item list to its single member.) Have you tried it when
there are several groups? That would be quite cool if it works.
>
> But this doesn't:
>
> tell application "Address Book"
> set currentGroups to every group of person "Sharon Steiner"
> remove person "Sharon Steiner" from currentGroups
> add person "Sharon Steiner" to group "Family"
> end tell
>
> --> "Address Book got an error: You can only remove a person from a
> group."
That's hardly surprising.
>
> In the first, it's dealing directly with the elements, whereas in the
> second it's trying to remove the person from a list.
Right. AppleScript lists do not respond to any command to 'remove' a list
item - if only they did.
>
> There's a grammatical error in the error message, though. It should
> be "You can remove a person only from a group."
Maybe.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden