Re: Saving HTML from Entourage
Re: Saving HTML from Entourage
- Subject: Re: Saving HTML from Entourage
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 28 May 2004 09:34:20 -0700
On 5/28/04 8:52 AM, I wrote:
>
Ah, WTH. Here's how to make an HTML file that will open in Safari (or
>
change it to IE or whatever). You do have to set a browser's creator type
>
or it opens in TextEdit without linked pictures, etc.
>
Although that seemed to worked fine as is, I should have added the <HTML>
</HTML> tags back in at top and bottom:
tell application "Microsoft Entourage"
set theMsg to item 1 of (get current messages)
set {theSubject, theSource, theContent, hasHTML} to {subject, source,
content, has html} of theMsg
end tell
if hasHTML then
set AppleScript's text item delimiters to {"<HTML>"}
try
set theText to text item 2 of theSource
set theCase to "UPPER"
on error
set AppleScript's text item delimiters to {"<html>"}
set theText to text item 2 of theSource
set theCase to "lower"
end try
if theCase is "UPPER" then
set AppleScript's text item delimiters to {"</HTML>"}
else
set AppleScript's text item delimiters to {"</html>"}
end if
set theText to text item 1 of theText
set AppleScript's text item delimiters to {""}
set theText to "<HTML>" & theText & "</HTML>" -- just in case
set filePath to (path to desktop as Unicode text) & theSubject & ".html"
else -- plain text
set theText to theContent
set filePath to (path to desktop as Unicode text) & theSubject & ".txt"
end if
try
set f to open for access file filePath with write permission
set eof f to 0
write theText to f
close access f
on error
try
close access f
end try
end try
if hasHTML then
tell application "Finder" to set creator type of alias filePath to
"sfri" -- MSIE, whatever
end if
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.