3 Replies Latest reply: May 26, 2008 8:39 AM by Bryan Schmiedeler
Bryan Schmiedeler Level 1 Level 1 (15 points)
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 8 Level 8 (41,020 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
  • Bryan Schmiedeler Level 1 Level 1 (15 points)
    This is a nice workaround. Thanks. And I have provided feedback to Apple, suggesting this as a future enhancement.
  • Bryan Schmiedeler Level 1 Level 1 (15 points)
    Also, the script did work just fine. Thanks!