Title: Re: Close All Message Windows script help
On 31/5/04 4:46 am, "Allen Watson" wrote:

On or near 5/30/04 2:22 AM, greg observed:

> I have been using a script to close all message and draft windows in
> Entourage X but it doesn’t seem to be working at all in version 2004.
> Can anyone help? Thanks!
>
>
>> tell application "Microsoft Entourage"
>>     close (every window whose class is message window or class is draft
>> window)
>> end tell
>
I tried your script and variations of it; it appears that Entourage 2004's AppleScript does not properly execute whose clauses for windows. Or at least for the class of windows. With a message window open, "every window whose class is message window" always returns "{}", which is incorrect. This is a bug, I believe.

This workaround should do the trick, abeit a bit more slowly:

tell application "Microsoft Entourage"
    set c to class of every window
    set w to every window
    repeat with i from 1 to (count w)
        if item i of c is in {message window, draft window} then close (item i of w)
    end repeat
end tell

Thanks for the workaround  Allen... Worked like a charm! And definitely not slower than the previous at all :)

greg

Reply via email to