Sort Contacts Marked As Company I found an Applescript at apple's support site to sort any contact with the "Company" checkmark checked into a "Business" group:

property groupName : "Business"
tell application "Contacts"
    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
end tell


It fails on:

            make new person at end of group groupName with data singlePerson


With error:

error "Contacts got an error: AppleEvent handler failed." number -10000


Does anyone know of a method to sort out all contacts checkmarked as "Company"?

For example I do NOT want anyone who has a company name but is an individual card:



But I DO want companies with the Company box checkmarked:
Update:

I originally thought You don't need Applescript to do this.

And you could create a Smart Group that does it for you.









BUT  the 'Company: is set' is not for the checkbox. Its for the actual Company text field.

So you cannot use the above for this as it does not care if the checkbox for company is ticked or not. It only cares if there is text in the Company field.

So Applescript IS the way to go. And using  company is true which refers to the checkbox.

    property groupName : "Business"
tell application "Contacts"

    if not (exists (group groupName)) then
        make new group with properties {name:groupName}
    end if
    set the_people to people whose company is true
    repeat with i from 1 to number of items in the_people
        set this_person to item i of the_people
        add this_person to group groupName
        save
    end repeat
end tell