Title: Re: Clean Forward Script
On or near 12/15/00 8:02 AM, Neil at [EMAIL PROTECTED] observed:

> I was talking about the stuff that Entourage _can't_ easily fix with menu
> commands.  The Emailer script would take out all the accumulated "fwd" and
> "fw" from the subject line.  

For cleaning up just the Subject line, you might try this. Just add any phrase you want deleted to the list at the top.

-- Cleans subject of incoming message by removing extraneous strings
-- "garbaj" is list of strings to strip out such as mailing list names
set garbaj to {"[iBook] ", "[ListName2]", "Fwd:", "(Fwd):", "(Fwd)", "  "}

tell application "Microsoft Entourage"
    set Msgs to the current messages
    repeat with theMsg in Msgs
        -- Clean up the subject field
        set theSubject to the subject of theMsg
        repeat with aPhrase in garbaj
            set aPhrase to aPhrase as text
            set theSubject to my SearchReplace(theSubject, aPhrase, "")
        end repeat
        set the subject of theMsg to theSubject
    end repeat
end tell

-- routine to do a search and replace on text
on SearchReplace(mainString, searchString, replaceString)
    set olddelis to applescript's text item delimiters
    
    set applescript's text item delimiters to searchString
    set thelist to (every text item of mainString)
    
    set applescript's text item delimiters to replaceString
    set thestring to thelist as string
    
    set applescript's text item delimiters to olddelis
    return thestring
end SearchReplace

--
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