Title: Script to file reply with original message
This is a script to replace Paul's "File Reply in Same Folder E" script, which I call, "File Reply with Original". Paul's script was ported from OE, which had no links between originals and replies, so it used a slow method of locating the originals. This script uses the provided links and is much faster.

Select one or more outgoing messages (other kinds will just be ignored if selected), say in your sent items folder, and this script will locate any originals to replies, and will move the reply into the folder with the original message. Set up the outgoing message rule as Paul suggested with his script, to run this AppleScript when the subject starts with "Re:", and it will file <all> your replies in the same folder as the original message, as they go out. (The script does not have the ability to select only certain folders for this process. If you don't want this script applied universally, you'll need to apply it manually to selected messages in Sent Items every now and then.)

tell application "Microsoft Entourage"
    set c to current messages
    set msgsMoved to 0
    repeat with aMsg in c
        if class of aMsg is outgoing message then
            if delivery status of aMsg is sent then
                set l to links of aMsg
                set subj to subject of aMsg
                set subj to my cleanText("Re: ", subj)
                repeat with x in l
                    if class of x is incoming message then
                        if subject of x contains subj then
                            set theFolder to storage of x
                            set the storage of aMsg to theFolder
                            set msgsMoved to msgsMoved + 1
                            exit repeat
                        end if
                    end if
                end repeat
            end if
        end if
    end repeat
    display dialog "" & msgsMoved & " messages moved."
end tell

on cleanText(snippet, mainText)
    set od to AppleScript's text item delimiters
    set AppleScript's text item delimiters to snippet
    set temp to text items of mainText
    set AppleScript's text item delimiters to ""
    set temp to temp as text
    set AppleScript's text item delimiters to od
    return temp
end cleanText
--
Peace,
Allen Watson <[EMAIL PROTECTED]> XNS name: =Allen Watson
A Mac family since 1984 <http://home.earthlink.net/~allenwatson/>
Applescripts for Outlook Express and Entourage: <http://homepage.mac.com/allenwatson/>

Reply via email to