On 14/03/2007 13:19, "[email protected]"
<[email protected]> wrote:
> At 11:22 AM -0600 3/8/07, Bellwether wrote:
>>> Is there any easy way to take the contents of a (fully formatted) html
>>> e-mail and save it, eg. in a MS Word document? I get the text in some
>>> level
>>> of formatting but it doesn't appear as it did in the e-mail.
>>
>> You can A) Drag the email out of Entourage into a file on your desk, which
>> can be opened in its own window, retaining its full formatting *and* all of
>> its hyperlinks;
>
> This saves the message as an Entourage .eml file, not html, as the
> original request was for. Unless I'm missing something.
Here is a rough & ready script to open the selected HTML email in Word - I
hope, later on, to be able to add attached graphics etc.
tell application "Microsoft Entourage"
set theMessage to item 1 of (get current messages)
set theTitle to subject of theMessage
set theContent to part 1 of theMessage
if type of theContent is "multipart" and subtype of theContent is
"alternative" then
-- there shourd be plain text & HTML parts
set htmlPart to item 1 of (parts of theContent whose type is "text"
and subtype is "html")
set theSource to content of htmlPart
else if type of theContent is "text" and subtype of theContent is "html"
then
-- Just an HTML Part?
set theSource to content of theContent
else
-- no HTML?
return
end if
end tell
set filePath to (path to desktop from user domain as text) & my
safeText(theTitle) & ".HTML"
set outFile to open for access filePath with write permission
write theSource to outFile
close access outFile
tell application "Microsoft Word"
activate
open (filePath as alias)
end tell
on safeText(x)
set oldTIDs to AppleScript's text item delimiters
repeat with aPair in {{":", "-"}, {"/", "|"}, {"\\", "|"}}
set AppleScript's text item delimiters to item 1 of aPair
set textParts to text items of x
set AppleScript's text item delimiters to item 2 of aPair
set x to textParts as string
end repeat
set AppleScript's text item delimiters to oldTIDs
return x
end safeText
--
Barry