On 10/26/01 8:18 AM, "Allen Watson" <[EMAIL PROTECTED]> wrote:
> On or near 10/25/01 9:26 PM, Dan Crevier at [EMAIL PROTECTED] observed:
>
>> On 10/22/01 6:06 PM, "Bryan Harris" <[EMAIL PROTECTED]> wrote:
>>
>>> Is there a way to convert an html message to plain text via AS?
>>
>> Just do something like:
>>
>> set the content of theMsg to the content of theMsg
>
> Dan, that is so cool! Mind explaining why it works? I've been using a
> complex script written way back when (Emailer? OE?) by Phil Kearney, which
> parses all the multiple parts of the message, etc, and then (in OS 9) used
> TextSoap to strip the HTML code. And you do it in one line!
'(get) content of theMsg' (the second half of Dan's one-liner) always gets
just the text (actually via its original Unicode, then the usual
Unicode-to-string automatic conversion). The Dictionary confirms that the
'content' property of a message is 'Unicode text', not 'styled text'. That's
why any effort to _preserve_ HTML when copying message text has to be much
more complicated: losing it is easy. When you then 'set the content of
theMsg' to what you have just saved, that's what you get: unstyled text. In
fact you can't specify HTML in a message even if you want to, unless it's a
reply or forward. You always get plain text.
This works both with draft windows (where you first 'set theMsg to front
window') and with saved messages: if you try it with a saved message
displayed in its own window ('set theMsg to displayed message of front
window') you won't see the change in the window until you close the
message.
'set the selection' in an HTML draft window gets you the current (or
default) styling, which is useful to know. And you can get the clipboard to
save as styled text if you want to.
--
Paul Berkowitz
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
To search the archives:
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>