Title: Re: Choosing contacts to synch
A couple of points that I hope add to the discussion:

1. While it is more difficult to add or delete a category to a contact than to simply toggle a true/false property, it can be done by script, and once the script is written, it is just as easy to use as a script to toggle the property. See below.

2. The Assign Categories window allows you to select the primary category. Just highlight the desired category, and then click the "Set Primary" button, which is located at the lower left.

Examples abound of scripts that add or subtract categories, but here are four handlers anyone can include in a script:

tell application "Microsoft Entourage"
-- Example of use
    set theItem to contact "Allen Watson"
    set theCat to category "Sync"
    makePrimaryCategory of me for theCat against theItem
-- Remainder of code just displays the result in Script Editor's result window
-- Not needed for actual use
    set c to category of theItem
    set namelist to {}
    repeat with ac in c
        copy name of ac to end of namelist
    end repeat
    return namelist
end tell


-- Make theCat the primary category for the item
to addPrimaryCategory for theCat onto theItem
    tell application "Microsoft Entourage"
        set c to the category of theItem
        if {theCat} is not in c then set c to {theCat} & c
        set the category of theItem to c
    end tell
end addPrimaryCategory

-- Remove category theCat from theItem
to removeCategory for theCat from theItem
    tell application "Microsoft Entourage"
        set c to the category of theItem
        if {theCat} is in c then
            set newc to {}
            repeat with i from 1 to count c
                set aCat to item i of c
                if aCat is not theCat then copy aCat to end of newc
            end repeat
            set the category of theItem to newc
        end if
    end tell
end removeCategory

-- addSecondary Category for the Item
to addSecondaryCategory for theCat onto theItem
    tell application "Microsoft Entourage"
        set c to the category of theItem
        if {theCat} is not in c then
            copy theCat to end of c
            set the category of theItem to c
        end if
    end tell
end addSecondaryCategory

-- Make a category the primary for an item
to makePrimaryCategory for theCat against theItem
    tell application "Microsoft Entourage"
        set c to category of theItem
        if {theCat} is in c then
            removeCategory of me for theCat from theItem
        end if
        addPrimaryCategory of me for theCat onto theItem
    end tell
end makePrimaryCategory

-- Check if an item already has a certain category
to checkForCategory for theCat against theItem
    tell application "Microsoft Entourage"
        set c to category of theItem
        return ({theCat} is in c)
    end tell
end checkForCategory

Granted, this is a lot more complex than merely togging a true/false value, but it’s all been done for you; just use it.
--
Microsoft MVP for Entourage/OE/Word (MVPs are volunteers)
Allen Watson <[EMAIL PROTECTED]> Entourage FAQ site: <http://www.entourage.mvps.org/>
AppleScripts for Outlook Express and Entourage:
 <http:[EMAIL PROTECTED]/Scripts/>
Entourage Help Pages: <http://www.entourage.mvps.org/>

Reply via email to