• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to get selected group in Address Book?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get selected group in Address Book?


  • Subject: Re: How to get selected group in Address Book?
  • From: Michelle Steiner <email@hidden>
  • Date: Mon, 20 Mar 2006 20:21:46 -0700

On Mar 20, 2006, at 8:08 PM, Robert Nicholson wrote:

set liste to {}
set avirer to {}
tell application "Address Book"
	with timeout of 3200 seconds
		--repeat with this_person in every person of group "Pimps"
		repeat with this_person in every person of group (get selection)

The selection can never be a group; it's always a person or people. To get the selection's contents, it has to be coerced into a list. You can then get the group of the first person of the list.


However, because a person can belong to more than one group, you will get a list of groups (or possibly a one-item list). I don't know how to determine which of those groups, if there is more than one, is the selected group.

Anyway, here is the code to get the list of groups:

tell application "Address Book"
	 group of item 1 of (the selection as list)
end tell

-- Michelle

--
it ain't "schadenfreude" if the bastards deserve it.


_______________________________________________ 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
References: 
 >How to get selected group in Address Book? (From: Robert Nicholson <email@hidden>)

  • Prev by Date: How to get selected group in Address Book?
  • Next by Date: Run Script until User Action
  • Previous by thread: How to get selected group in Address Book?
  • Next by thread: Run Script until User Action
  • Index(es):
    • Date
    • Thread