Title: Re: Open email in Safari
On or near 8/21/04 12:38 AM, Kenneth Taylor at [EMAIL PROTECTED] observed:

> Hello Colleagues,
>
> I am new to Entourage from Eudora ... Is there a quick way to open an email
> message in a browser? I have html turned off and some email is hard to read.
> ----------------------------------------------------------
> Kenneth Taylor
> Email: <mailto:[EMAIL PROTECTED]>
>
Try this script: copy it into Script Editor, save into Entourage Script Menu Items folder, then execute it with an HTML message selected, by choosing it from the Script menu.

property browser : ""

if browser = "" then
   set browser to choose file of type "APPL" with prompt "Please select your default browser."
end if
tell
application "Finder" to set defBrowserName to name of browser

tell application "Microsoft Entourage"
    set theMsg to item 1 of (get current messages)
    try
       if has html of theMsg is true then
           set pts to item 1 of (get parts of theMsg)
            set pts to parts of pts
           repeat with i from 1 to (count pts)
                set aPart to item i of pts
               set theType to type of aPart
               set theSubtype to subtype of aPart
               if theType is "text" and theSubtype is "html" then
                   set theHTML to content of aPart
                   exit repeat
               end if
           end repeat
           try
               get theHTML
           on error
               display dialog "Unable to extract HTML from this kind of message."
                return
           end try
           --            try
           --            tell application "Finder" to delete file "tempHTML2.html"
           --    end try
           set tempfile to open for access "tempHTML2.html" with write permission
           write theHTML to tempfile
           close access tempfile
           set theFile to "tempHTML2.html"
        else
           display dialog "Selected message seems to have no HTML to open."
            return
       end if
   on error theErr
       display dialog theErr
       return
   end try
end
tell
set
theDisk to path to startup disk as string
set theFile to theDisk & theFile
-- Give the file the creator type of the default browser
tell application "Finder"
    set f to alias theFile
   set ct to creator type of browser
   set ft to "TEXT"
    set creator type of f to ct
   set file type of f to ft
end tell
try
   set thePath to POSIX path of theFile
   set theDisk to text 1 thru -2 of theDisk -- remove delimiter
   set theURL to "file://" & theDisk & thePath
   tell application defBrowserName
       activate
       open location (theURL)
    end tell
on
error theErr
   display dialog theErr
end try
delay 5
tell application "Finder" to delete theFile

Reply via email to