In case anyone is interested & can make sense of it, here is the 'dequote
selection' script from emailer on the odd chance it can be modified.....

thanks!-- De-Quoter v1.0
-- January 10, 1998
-- strip out ">" quote marks from the selection of a message
-- by Eric Scheid, Ironclad Internet, [EMAIL PROTECTED]

-- CAUTION: if the text content of the selection appears in
-- exactly the same form in front of the actual selection,
-- then that earlier occurance will be replaced, not the selection.
-- example: in a message that looks like:
--      some text
--      >blather-blah
--      >more quoted text
--      >blather-blah
-- and you select the second line of ">quoted text",
-- then the first line of ">quoted text" will be stripped,
-- not the second occurance
--
-- Sorry, nothing can be done about that :-(
--
-- but then, how likely is that situation to occur ;-)

property prefixes_to_strip : {" > ", "> ", " >", ">"}
-- note: prefixes are checked in sequence,
-- so it's important to put substrings last
-- otherwise ">" will get stripped out before "> ",
-- which would leave all lines prefixed with " "

on run
        tell application "Emailer 2.0v3"
                activate
                
                set windowClass to the class of the front window
                if windowClass is not in {incoming message window, outgoing 
message
window} then
                        display dialog ¬
                                "This script only works on a selection in a 
displayed message"
buttons {"OK"} ¬
                                default button {"OK"}
                        return false
                end if
                
                
                set selected_content to the selection
                if selected_content is "" then
                        display dialog ¬
                                "This script only works on a selection in a 
displayed message"
buttons {"OK"} ¬
                                default button {"OK"}
                        return false
                end if
                
                set selectedContent to the selection
                
                set oldDelims to AppleScript's text item delimiters
                set AppleScript's text item delimiters to return
                set theLines to the text items of selectedContent
                set AppleScript's text item delimiters to oldDelims
                
                set newLines to {}
                repeat with theLine in theLines
                        set theNewLine to theLine
                        repeat with thePrefix in prefixes_to_strip
                                if theLine starts with thePrefix then
                                        set theNewLine to my 
stripPrefix(theLine, thePrefix)
                                        exit repeat -- thus "> > blah" won't 
get stripped to " blah"
                                end if
                        end repeat
                        set newLines to newLines & theNewLine
                end repeat
                set oldDelims to AppleScript's text item delimiters
                set AppleScript's text item delimiters to return
                set newLines to the newLines as text
                set AppleScript's text item delimiters to oldDelims
                
                if windowClass is incoming message window then
                        set theWindow to front window
                        set theMsg to displayed message of theWindow
                        set theContent to the content of theMsg
                        set theOffset to the offset of selectedContent in 
theContent
                        
                        -- v1.0.1 bug fix : offset of "x" in "xyz" is 1, not 
zero
                        if theOffset = 1 then -- there is no text in front of 
the selection
                                set thePreamble to ""
                        else -- there is text in front of the selection
                                set thePreamble to characters 1 thru (theOffset 
- 1) of theContent as text
                        end if
                        
                        if (theOffset + the (length of selectedContent)) < the 
length of
theContent then -- there is text after the selection
                                set thePostamble to characters (theOffset + the 
(length of
selectedContent)) thru -1 of theContent as text
                        else -- there is no text following the selection
                                set thePostamble to ""
                        end if
                        
                        set newContent to thePreamble & newLines & thePostamble
                        
                        set the content of theMsg to newContent
                else
                        set the selection to newLines
                end if
                
        end tell
end run

on stripPrefix(theLine, thePrefix)
        if length of theLine > length of thePrefix then
                return characters (1 + (length of thePrefix)) thru -1 of 
theLine as text
        else
                return ""
        end if
end stripPrefix


Reply via email to