It appears that Dave Groover wrote:

> . . .his mails now come into Emailer as an attached HTML file . . .

If Uncle would rather fight than switch, you could holler "Uncle"
and use the script which I put together from two which I believe
that I got from the Fog City site.  Just place this script in
Emailer's AppleScripts folder and invoke it from Emailer's menu bar
AppleScript menu.  It takes a few seconds to run through (on my
250 mhz machine), but it delivers the HTML message to the body
window, stripped of HTML characters (you must have "Tex-Edit Plus"
on your hard drive, but everybody should have it anyway):

***************************************************************

HTML TO BODY & STRIP

tell application "Claris Emailer"
        set theMessage to the displayed message of the front window
        set OldFile to the name of the files of the displayed message of the
front window
end tell

set OldFileRef to (open for access (alias OldFile) without write
permission)
set htmlText to read OldFileRef
close access OldFileRef

tell application "Finder"
        delete (OldFile as alias)
end tell

tell application "Claris Emailer"
        activate
        set currBody to the content of theMessage
        set content of theMessage to currBody & return & return & htmlText
        select menu item "Save" of menu "File"
end tell
tell application "Claris Emailer"
        set theWindow to window 1
        set windowClass to the class of theWindow
        if windowClass is incoming message window or windowClass is outgoing
message window then
                set theText to the content of the displayed message of theWindow

                tell application "Tex-Edit Plus"

                        make window with properties {contents:theText}
                        tell window 1
                                set color of contents to black

                                -- horizontal rule

                                replace looking for "<HR>" replacing with
"---------------------------------"

                                -- create list if lines start with asterisk and create 
headers if
large fonts used

                                replace looking for "<H1>^*</H1>" replacing with "^*" 
replacing with
styles {style:{bold}, size:24}
                                replace looking for "<H2>^*</H2>" replacing with "^*" 
replacing with
styles {style:{bold}, size:18}
                                replace looking for "<H3>^*</H3>" replacing with "^*" 
replacing with
styles {style:{bold}, size:14}
                                replace looking for "<H4>^*</H4>" replacing with "^*" 
replacing with
styles {style:{bold}, size:12}
                                replace looking for "<H5>^*</H5>" replacing with "^*" 
replacing with
styles {style:{bold}, size:10}
                                replace looking for "<H6>^*</H6>" replacing with "^*" 
replacing with
styles {style:{bold}, size:9}

                                -- list items

                                replace looking for "<LI>" replacing with "*"

                                -- paragraphs

                                replace looking for "<P>" replacing with "^c"

                                -- translate some of the text style attributes to 
their HTML analogue

                                replace looking for "<B><I><U>^*</U></I></B>" 
replacing with "^*"
replacing with styles {style:{bold, italic, underline}}
                                replace looking for "<B><I>^*</I></B>" replacing with 
"^*" replacing
with styles {style:{bold, italic}}
                                replace looking for "<B><U>^*</U></B>" replacing with 
"^*" replacing
with styles {style:{bold, underline}}
                                replace looking for "<I><U>^*</U></I>" replacing with 
"^*" replacing
with styles {style:{italic, underline}}
                                replace looking for "<B>^*</B>" replacing with "^*" 
replacing with
styles {style:bold}
                                replace looking for "<I>^*</I>" replacing with "^*" 
replacing with
styles {style:italic}
                                replace looking for "<U>^*</U>" replacing with "^*" 
replacing with
styles {style:underline}
                                replace looking for "<BIG>^*</BIG >" replacing with 
"^*" replacing
with styles {style:expanded}
                                replace looking for "<SMALL>^*</SMALL >" replacing 
with "^*"
replacing with styles {style:condensed}
                                replace looking for "<STRIKE>^*</STRIKE >" replacing 
with "^*"
replacing with styles {style:outline}
                                replace looking for "<BLINK>^*</BLINK >" replacing 
with "^*"
replacing with styles {style:shadow}

                                -- Remove all HTML tags

                                replace looking for "<^*>" replacing with ""

                                -- Translate some special characters

                                replace looking for "&" replacing with "&"
                                replace looking for "<" replacing with "<"
                                replace looking for ">" replacing with ">"
                                replace looking for "&quot;" replacing with "\""
                                replace looking for "&laquo;" replacing with "<<"
                                replace looking for "&raquo;" replacing with ">>"
                                replace looking for "&not;" replacing with "-"
                                replace looking for "&divide;" replacing with "/"
                                replace looking for " " replacing with " "
                                replace looking for "&nbsp;" replacing with " "
                                replace looking for "&gt;" replacing with " "
                                replace looking for "&#133;" replacing with "..."
                                replace looking for "&#145;" replacing with "'"
                                replace looking for "&#146;" replacing with "'"
                                replace looking for "&#147;" replacing with "�"
                                replace looking for "&#148;" replacing with "�"
                                replace looking for "&#149;" replacing with "o"
                                replace looking for "&#151;" replacing with "--"
                                replace looking for "&#153;" replacing with "(TM)"
                                replace looking for "&#169;" replacing with "(C)"
                                replace looking for "&#174;" replacing with "(R)"

                                strip window 1 removing double spaces
                                stupefy window 1 converting quotes
                                stupefy window 1 converting ligatures
                                stupefy window 1 converting ellipses
                                stupefy window 1 converting dashes
                                strip window 1 removing double spaces
                                replace window 1 replacing multiple spaces with single 
space
                                strip window 1 removing diacriticals
                                strip window 1 removing low ascii
                                strip window 1 removing high ascii
                                strip window 1 removing leading spaces
                                strip window 1 removing trailing spaces
                                strip line endings window 1 removing crlf with line 
length 40

                                -- some of my own ideas and I am leaving them here in 
case I need
them later: replace looking for "
" replacing with " " replace looking
for "  " replacing with " "

                        end tell
                        set theText to the contents of window 1
                        close window 1 saving no
                end tell

                set the content of the displayed message of theWindow to theText
                save theWindow
        end if
end tell
tell application "Tex-Edit Plus"
        quit saving no
end tell

***************************************************************

Best regards,

Bill






_______________________________oOo______________________________
William D. Bandes     [EMAIL PROTECTED]    Zephyr Cove NV USA

Attachment: HTML to Body & Strip.SIT
Description: Macintosh archive

Reply via email to