Re: Address book & Groups
Re: Address book & Groups
- Subject: Re: Address book & Groups
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 05 Apr 2007 12:28:37 -0700
- Thread-topic: Address book & Groups
On 4/4/07 7:12 PM,
"applescript-users-bounces+berkowit=email@hidden"
<applescript-users-bounces+berkowit=email@hidden> wrote:
>
> tell application "Address Book"
> set the_peeps to (choose from list (get name of the people) with
> multiple selections allowed)
> set the_groups to (choose from list (get name of the groups))
> repeat with the_peep in the_peeps
> copy person the_peep to after the people of group (item 1 of
> the_groups)
Simpler:
add person the_peep to group (item 1 of the_groups)
> end repeat
> save addressbook
> end tell
>
> I couldn't figure out a way to put them all in the group all at once,
> so had to use the repeat.
Actually, you haven't answered Bob's question, Michelle. He was asking : how
to add a particular person to several groups. You have shown him how to add
several people to one group.
Here's how to add one person to several groups:
tell application "Address Book"
set the_peep to item 1 of (choose from list (get name of the people))
set the_groups to (choose from list (get name of the groups) with
multiple selections allowed)
repeat with the_group in the_groups
add person the_peep to group the_group
end repeat
save addressbook
end tell
(It looks like there should be another way, too, since group is an element
of person as well as vice-versa. But that's actually a sort of 'read-only'
element - which is not something that AppleScript ever tells you or knows
about - since you can't make a new group at a person; you can only _get_
existing 'groups of person the_peep'.)
--
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:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden