Title: Re: Script To Delete & Close Message Windows
I bet you thought this thread was dead. ;^)

Shortly after I subscribed to this list a few weeks ago, I began using Allen Watson’s script below to delete unwanted messages after I’ve read them, either in their own window or in the bottom pane of the Mail window. Because my numerous POP accounts are all configured in EvX to “leave a copy of the message on the server” -- a necessary evil for my also numerous jobs -- I made one modification just ahead of the “delete theMsg” line near the end of the script by adding “set connection action of theMsg to remove at next connection” so with a keyboard combination I can remove the message from the server and put it in Deleted Items. Yippee.

Incidentally, I’ve also used “move theMsg to deleted mail folder” in place of “delete theMsg”; no apparent difference.

My mail list windows are sorted by date modified descending. When I run this script, I would like the subsequently selected message (after the deletion occurs) to be the message above the one I deleted (the next most recent), but it’s the message below the one I deleted (the next oldest) that becomes selected. (By comparison, if I click on the Trash icon or Message->Move to->Deleted Items, the message above the one I Trash/Move becomes selected.) Sorry to be so long-winded, but how can I get what I want when I use this script? Thanks.

--
Christopher Robbins
...Upon that snow, out in that crystal land!

From: Allen Watson <[EMAIL PROTECTED]>
Reply-To: "Entourage:mac Talk" <[EMAIL PROTECTED]>
Date: Sat, 22 Jun 2002 19:03:01 -0700
To: Entourage mac Talk <[EMAIL PROTECTED]>
Subject: Re: Script To Delete & Close Message Windows


On or near 6/22/02 1:15 PM, greg at [EMAIL PROTECTED] observed:

> Hi George,
>
> This one worked great but what if some of the messages selected do not have
> open windows?
>
If a selected message had no window, it would not get deleted. This affects, as George said, "only messages that are both selected and open".

So, what is it you want to do? Delete all messages that are selected, and, if they have open windows, close them? To do that, I think this will work:

tell application "Microsoft Entourage"
    set winlist to every window
    set msglist to current messages
    set idList to {}
    repeat with aMsg in msglist
        copy ID of aMsg to end of idList
    end repeat
    repeat with thewin in winlist
        if class of thewin is message window then
            if (ID of displayed message of thewin) is in idList then close thewin
        end if
    end repeat
    repeat with theMsg in msglist
        delete theMsg
    end repeat
end tell


--
My web page: <http://home.earthlink.net/~allenwatson/>
My scripts page: <http:homepage.mac.com/allenwatson>
Microsoft MVP for Mac Entourage/Word--<[EMAIL PROTECTED]>


Reply via email to