You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Smart Group that contains Cards with "Company" Marked

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)

Posted on May 26, 2008 6:12 AM

Reply
Question marked as Top-ranking reply

Posted on May 26, 2008 6:59 AM

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
3 replies
Question marked as Top-ranking reply

May 26, 2008 6:59 AM in response to Bryan Schmiedeler

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

Smart Group that contains Cards with "Company" Marked

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.