3 Replies Latest reply: Jan 17, 2014 11:33 AM by jhacklem
Janice1758 Level 1 Level 1 (0 points)

When contact card displayed, how do I determine which Group that contact is in? In my address book, when I search for a contact in All Contacts, and the card is displayed, how can I then tell which Group (or groups) that contact is in?


MacBook
  • 1. Re: When a contact card is displayed, how can I tell which sub-group that contact is in?
    disguise Level 2 Level 2 (345 points)

    Here's an AppleScript that will do show all groups belonged to by the selected person

     

    tell application "Address Book"

              set nameList to {}

              set thisPerson to selection

     

              set groupList to properties of groups of (item 1 of thisPerson)

              set numberOfGroups to count of groupList

              repeat with i from 1 to numberOfGroups

                        set groupName to (get name of item i of groupList) as string

                        set nameList to nameList & groupName

              end repeat

     

              return nameList

     

    end tell

     

    If you're not familiar with AppleScripts, launch Applications -> Utilities -> AppleScript

     

    copy and paste the above script into the AppleScript editor

     

    click the <Compile> button to verify syntax

     

    Now, to run the script, Open the Address Book and select a contact from "All Contacts"

     

    now run the script.

  • 2. Re: When a contact card is displayed, how can I tell which sub-group that contact is in?
    disguise Level 2 Level 2 (345 points)

    Here's one that doesn't require the Address Book application to be launched

     

    display dialog "Please enter first name of contact:" default answer "First Name"

    set firstName to text returned of result

    display dialog "Please enter the last name of contact:" default answer "Last Name"

    set lastName to text returned of result

     

    tell application "Address Book"

              set nameList to {}

      (* set thisPerson to selection *)

              set thisPerson to every person whose first name is firstName and last name is lastName

     

              set groupList to properties of groups of (item 1 of thisPerson)

              set numberOfGroups to count of groupList

              repeat with i from 1 to numberOfGroups

                        set groupName to (get name of item i of groupList) as string

                        set nameList to nameList & groupName

              end repeat

     

              return nameList

     

    end tell

  • 3. Re: When a contact card is displayed, how can I tell which sub-group that contact is in?
    jhacklem Level 1 Level 1 (0 points)

    Janice--

     

    Was your December 2012 group contact query resolved? Does the solution function in Mavericks?