Title: Re: Sorting threads with "Re:"
Here's an alternative script that removes <anything> that appears in square brackets from the subject line. So it will work for any group that inserts a group name prefix.

on run
    tell application "Microsoft Entourage" --
        set currentMessages to the current messages --
        repeat with theMsg in the currentMessages --
            set str to the subject of theMsg
            set x to str -- Save for comparison
            if str contains "]" then
                -- Search for something like "Re: [xxxx]" at the start of the subject, and strip it
                if str begins with "[" or str begins with "re:[" or str begins with "re: [" then
                    -- Remove "re:"
                    set re to str begins with "re:"
                    if re then
                        set str to text 4 thru -1 of str
                    end if
                    --Now remove the bracketed prefix
                    set sd to AppleScript's text item delimiters
                    set AppleScript's text item delimiters to "]"
                    try
                        set temp to text items 2 thru -1 of str
                        set str to temp as text
                    on error
                        set str to "<No Subject>"
                    end try
                    set AppleScript's text item delimiters to sd
                    if re then
                        set str to "Re:" & str
                    end if
                    --Remove possible leading blank(s)
                    repeat while (character 1 of str is " ")
                        try
                            set str to text 2 thru -1 of str
                        on error
                            set str to "<No Subject>"
                        end try
                    end repeat
                end if
                -- If found, replace subject, otherwise leave subject alone
                if str is not equal to x then
                    set subject of theMsg to str
                end if
            end if
        end repeat --
    end tell --
end run

--
Microsoft MVP for Entourage/OE/Word (MVPs are volunteers)
Allen Watson <[EMAIL PROTECTED]> Entourage FAQ site: <http://www.entourage.mvps.org/>
AppleScripts for Outlook Express and Entourage:
 <http:[EMAIL PROTECTED]/Scripts/>
Entourage Help Pages: <http://www.entourage.mvps.org/>

> From: Mark and Theresa <[EMAIL PROTECTED]>
> Reply-To: "Entourage:mac Talk" <[EMAIL PROTECTED]>
> Date: Sun, 27 Oct 2002 12:22:30 +0000
> To: "Entourage:mac Talk" <[EMAIL PROTECTED]>
> Subject: Sorting threads with "Re:"
>
> I am on a mailing list that has several different replying styles used. The
> first has "Insrt name of group" first, so "[group] chickens" would be
> followed up with "[group] Re: chickens". On the other hand some use a
> different style  as is the reply being "Re: [group] chickens". Is there any
> way of lumping these in one thread rather than having them replies split?
>
> On a similar subject what about people on two lists "crossposting"? The same
> message might appear twice … can we get round this in some way too?
>
> Thankses
> --
> Be Seeing You,
>
> Mark
>
>
> --
> To unsubscribe:                     
> <mailto:[EMAIL PROTECTED]>
> archives:       
> <http://www.mail-archive.com/entourage-talk%40lists.letterrip.com/>
> old-archive:       
> <http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>

Reply via email to