Title: file originals after reply
I have an outgoing email rule that says if: subject starts with re: run the below script.

The email sends fine, but the time the script takes to do its business is pretty long, seconds to say the least.

Is there a "leaner" version of below?

-- One of my favorite features of Claris Emailer was its ability to move messages to the Read Mail folder
-- after I replied to them. This way, I could use the In Box as a sort of "to do" list. Once I replied to an item,
-- it was automatically taken off my list of messages needing attention from me. The In Box then contained
-- only the things I actively needed to investigate. This script brings the feature to Outlook Express 5,
-- except now it's even better!

-- To use it you need to do the following things:
--      1) Set up a folder in which the messages you reply to should be filed
--         (I set up a subfolder of the Inbox called "Finished")
--     2) set the three variables below in the script as appropriate for your situation, compile, and resave
--     3) Set up a Mail Rule to run this script on all outgoing messages whose subject lines begin with "Re:"
--         (that way it's only run on replies; no point wasting time running the script on other messages)

tell application "Microsoft Entourage"
    
    -- These are the folders from which you want to move mail that you reply to
   -- In Claris Emailer you could only do this from the In Box; in this script you can select several folders
   -- If you reply to a message that's already in a folder _besides_ one of these, it will not be moved
   set theFolders to {folder "Inbox"}
    
    -- This is the name of the folder in which you want to store messages after replying to them
   -- You need to create this folder yourself before using the script
   set theFinishedFolder to folder "!!!!*Read Mail*!!!!"
    
    -- Set this to true if you would like the original message closed automatically after the reply is sent
   set closeOriginal to false
   
    set theOriginals to {}
    repeat with theFolderName in theFolders
       set theOriginals to theOriginals & (get every message of theFolderName whose replied to is true)
    end repeat
   set foundOriginal to false
   set currentMessages to (get current messages)
    repeat with theReply in currentMessages
       set replyHeaders to headers of theReply
       repeat with theMessage in theOriginals
           set theHeaders to paragraphs of (get headers of theMessage)
            repeat with theHeader in theHeaders
               if theHeader begins with "Message-ID" then
                   set messageID to characters 13 thru -1 of theHeader as text
                   if replyHeaders contains "In-Reply-To: " & messageID then
                       move theMessage to theFinishedFolder
                       if closeOriginal then
                           set theWindows to (every window whose class is message window)
                            repeat with thewindow in theWindows
                               if the ID of the displayed message of thewindow is the ID of theMessage then
                                   close thewindow
                                   exit repeat
                               end if
                           end repeat
                       end if
                       set foundOriginal to true
                       exit repeat
                   end if
               end if
           end repeat
           if foundOriginal then exit repeat
       end repeat
   end repeat
end
tell



--
-------------------------------------------------------------
Scott Haneda                                Tel: 415.898.2602
<http://www.newgeo.com>                     Novato, CA U.S.A.

Reply via email to