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: Michelle Steiner <email@hidden>
- Date: Mon, 23 May 2005 12:02:04 -0700
On May 23, 2005, at 10:37 AM, Paul Berkowitz wrote:
In addition, David wanted to _change_ a group, not just add one,
but remove
the previous one(s). That can be done like this:
tell application "Address Book"
set currentGroups to every group of person "Sharon Steiner"
repeat with i from 1 to (count currentGroups)
set currentGroup to item i of currentGroups
remove person "Sharon Steiner" from currentGroup
end repeat
add person "Sharon Steiner" to group "Family"
end tell
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
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."
In the first, it's dealing directly with the elements, whereas in the
second it's trying to remove the person from a list.
There's a grammatical error in the error message, though. It should
be "You can remove a person only from a group."
-- Michelle
--
We are like tenant farmers chopping down the fence around our house
for fuel when we should be using nature's inexhaustible sources of
energy - sun, wind and tide. I'd put my money on the sun and solar
energy. What a source of power! I hope we don't have to wait until
oil and coal run out before we tackle that.
-- Thomas Alva Edison (1847-1931)
_______________________________________________
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