referencing a selected group in Address Book

How do I get the name of the group that a user is highlighting in the Address Book? Here is a code snippet that does not work.

tell application "Address Book"
	set the_Group to name of group selection as text
	display dialog the_Group
end tell

Try:

tell application "Address Book" to get name of first group whose selected is true

I get the following error “Address Book got an error: Can’t make name of group 1 whose selection = “true” into type reference.”

I used the following applescript:

tell application "Address Book"
	set theName to get name of first group whose selection is true as text
	display dialog theName
end tell

You should have used the script adayzdone gave you. :wink:

Yes, I used that also. They both gave the same error. I should have been more specific. My bad.

selection vs. selected and without that useless as text coercion

The error, as Stefan’s pointed out, is that you’ve got ‘selection’ instead of ‘selected’. However, I see that the ‘selected’ property was introduced with Address Book 5 in Snow Leopard. It doesn’t exist in Address Book 4.1.2 on my Leopard system. Are you by any chance using an older version?