Skip navigation
This discussion is archived

Smart Group that contains Cards with "Company" Marked

1006 Views 3 Replies Latest reply: May 26, 2008 8:39 AM by Bryan Schmiedeler RSS
Bryan Schmiedeler Level 1 Level 1 (15 points)
Currently Being Moderated
May 26, 2008 6:12 AM
I would like to create a smart group with cards where the "Company" field checkbox is checked. I can create a card where the field "Company" has something filled in, but that is not what I want, as I have many contacts who work at a company - I am interested in those that ARE a company.

Any way I can do this?

Bryan Schmiedeler
2.4GHz Intel Core 2 Duo, Mac OS X (10.5.2)
  • Barney-15E Level 7 Level 7 (33,405 points)
    I have never been able to make that work. The "Company" in the smart group is the field, not the checkbox, so there doesn't seem to be a way to make that work. Here is an Applescript that will move any contact with Company checked into a particular Group.
    You can change the group name by changing the string "Business" to something else.
    property groupName : "Business"
    tell application "Address Book"
    if (name of groups as list) does not contain groupName then
    make new group at end of groups with properties {name:groupName}
    end if
    repeat with singlePerson in people
    if company of singlePerson is true then
    if (people of group groupName as list) does not contain (singlePerson as list) then
    make new person at end of group groupName with data singlePerson
    end if
    end if
    end repeat
    save addressbook
    end tell

    It takes while to run if you have a lot of contacts. It can be run multiple times as it checks to see if the person is already in the group.
    It is interesting that the Applescript library distinguishes between the "Company" and the "Organization," but the Smart Groups does not. Feedback to Apple might be helpful to get it fixed.

    EDIT: Forgot to mention, you copy the code into Script Editor and save as an application. You can then run the program you saved to update your Business group. I threw in the 'save addressbook' command to try and get it to update after it is complete, but I didn't get a chance to check it out. If it doesn't update, close and re-open Address Book (or run the script while AB is closed) and it will be updated.

    Message was edited by: Barney-15E
    1.8 SP G5/iMac G4 FP/MBP 2.33/PB G3 Pismo, Mac OS X (10.5.2), XLR8 G4 Upgrade for Pismo


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.