Title: Re: Script to Remove Quoting
On or near 7/4/02 4:19 AM, David Morganstein at [EMAIL PROTECTED] observed:

> Is there a script around to remove quoting from selected text?  I do that
> often and  would like to assign a keyboard shortcut (ala Eudora).

But what you were asking for is a script, so if you <really> want one you can assign a keyboard shortcut to:

(*
Modified by Omar Shahine <[EMAIL PROTECTED]> to work with Outlook Express 4.0
Adapted by Allen Watson from "Decrement Quote Level" by Dan Crevier and Omar Shahine, to strip all leading quote characters (>)  from a message's lines.
*)
on run {}
    if not CheckMessageWindow() then return
    tell application "Microsoft Entourage"
        activate
        set theWindow to the front window
        set theText to the selection of the theWindow
        set ReplaceAll to false
        if theText is "" then
            set theText to the content of the theWindow
            set ReplaceAll to true
        end if
        set theLines to the paragraphs of theText
        set theNewText to ""
        repeat with theLine in theLines
            repeat while theLine starts with ">" or theLine starts with "> "
                repeat while theLine starts with "> "
                    if length of theLine > 2 then
                        set theLine to text 3 thru -1 of theLine
                    else
                        set theLine to ""
                    end if
                end repeat
                repeat while theLine starts with ">"
                    set theLine to text 2 thru -1 of theLine
                    exit repeat
                end repeat
            end repeat
            set theNewText to theNewText & ¬
                theLine & ¬
                return
        end repeat
        try
            if ReplaceAll then
                set the content of theWindow to theNewText
            else
                set the selection of theWindow to theNewText
            end if
        on error
            display dialog "Cannot edit this message. Did you click the Edit button?"
        end try
    end tell
end run
-- make sure a outgoing message window is frontmost
--written by Dan Crevier
on CheckMessageWindow()
    tell application "Microsoft Entourage"
        activate
        set msgClass to the class of the front window
        if msgClass is not draft window and msgClass is not message window and msgClass is not draft news window then
            display dialog "This script is designed to work with a message window frontmost." buttons {"Okay"} with icon stop
            return false
        end if
    end tell
    return true
end CheckMessageWindow

--
My web page: <http://home.earthlink.net/~allenwatson/>
My scripts page: <http:homepage.mac.com/allenwatson>
Microsoft MVP for Mac Entourage/Word--<[EMAIL PROTECTED]>

Reply via email to