Title: Re: Missing criteria in Find for Contacts? -- correction
On 10/24/00 1:10 AM, I wrote:

          --------TOGGLE FLAGGED CATEGORY---------------
          
Oops, done it again. I had one line in the wrong place.
Correction:


   --------TOGGLE FLAGGED CATEGORY---------------

tell application "Microsoft Entourage"
    
    try
        set theSelection to the selection -- might be nothing selected
        if class of theSelection � list then error -128
        if class of item 1 of theSelection � contact then error -128
    on error
        beep
        display dialog "You need to select a contact in the Address Book." buttons {"OK"} default button "OK" with icon 0
        return
    end try
    
    try
        set theCat to first category whose name is "Flagged" -- needs this syntax so as not to error
    on error
        beep
        display dialog "This script only works if you have a \"Flagged\" category." buttons {"OK"} default button "OK" with icon 0
        return
    end try
   
     repeat with theCtc in theSelection
        set ctcCategories to category of theCtc
        if flagged of theCtc is true then
            if ctcCategories does not contain {theCat} then
                set category of theCtc to (ctcCategories & {theCat})
            end if
        else
            set newCategories to {}
            repeat with i from 1 to (count ctcCategories)
                set theCategory to item i of ctcCategories
                if name of theCategory � "Flagged" then
                    set end of newCategories to theCategory
                end if
            end repeat
            set category of theCtc to newCategories
        end if
    end repeat
end tell

-----------------------end script-------------------


--
Paul Berkowitz

Reply via email to