Title: Re: Simple script question
On 8/10/02 2:03 PM, "Paul Berkowitz" <[EMAIL PROTECTED]> wrote:

>> I tried the following, which compiles fine but it doesn't actually work ;)
>>
>>   set the category name of theMsg to "Junk"
>>
>>
>   set category of theMsg to {category "Junk"}
>
> As far as i understand, you're trying to change the category, not the name
> of the category.

Righto.


> And the category of an item - a message, contact, whatever - is a list -
> as the Dictionary says - of Entourage categories. (A little confusing
> for sure.) Hence the list brackets, and the list item being a category.

Thanks, Paul; it is a bit confusing to those of us not well-versed in the wonders of AppleScript. Except that for some reason

    set category of theMsg to {category "Junk"}

isn't actually setting the category. The script compiles fine, and the other parts of the script (set status to read, move to SPAM folder) work fine. In fact, here's the entire thing:


tell application "Microsoft Entourage"
    set currentMessages to the current messages
   if currentMessages = {} then
       error "No messages selected. Select at least one message in a folder, or open a message to file."
        error -128
    end if
   repeat with theMsg in the currentMessages
       my ProcessMsg(theMsg)
    end repeat
end
tell

on ProcessMsg(theMsg)
    tell application "Microsoft Entourage"
        set the read status of theMsg to read
       set category of theMsg to {category "Junk"}
        move theMsg to folder " SPAM"
    end tell
   tell the front window
       if class is message window then close
   end tell
end
ProcessMsg

Reply via email to