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 07:18:31 -0700
On 5/28/04 1:45 AM, "Mr Tea" <email@hidden> wrote:
>
On 28 May 2004, at 2735 am, Paul Berkowitz wrote:
>
>
> That's doable, but since it's a bit complicated, please
>
> say first if that's what you want and how exactly you'd like to save
>
> it.
>
> Save it to what?
>
>
Thanks for the response, Paul. I should, of course, have been more
>
explicit. When I wrote "how do I script saving a message as html in
>
Entourage?", I meant "how can I use applescript to make Entourage X
>
save an incoming message as an external, stand-alone HTML document".
>
>
Generally speaking, I want to script the the same thing that happens if
>
I open a message, choose 'save as..." from the 'File' menu, and select
>
'HTML Document' from the dropdown 'Format' menu in the save dialog.
>
(The HTML option is only available in the dialog when the message has
>
HTML content.)
You can't script that explicitly unless you want to venture into the wilds
of GUI-scripting Entourage, which has very mixed results from some previous
attempts (never tried this one though).
>
>
Specifically, I receive a couple of 'what's on' email newsletters from
>
local multiplexes, and want to save them to a folder in the Finder,
>
where they will subsequently be found by my web browser, and I want to
>
do this with a script that runs as part of a rule.
>
>
This is as far as I got....
>
>
tell application "Microsoft Entourage"
>
set UGCData to 1st message of folder "Inbox" whose subject contains
>
"UGCMail : Schedule" -- (would 'current message' work here, if the
>
script is running as part of a rule?)
The dictionary is not very expansive, but there must be 1000 or so Entourage
and OE scripts out there which show the way. You can't use 'current
message', which won't compile, but the 'application' entry shows a property
current messages - list of reference [r/o] -- the current messaged
depending on context, including message currently being filtered
Not well described, but you see it's a list:
set UGCData to item 1 of (get current messages)
is how to refer to a message being filtered by a rule. It also works for the
currently selected message in a message list in the main window if you run
the script manually - so it works for testing too.
(You need either the 'get' or have to to it in two lines setting a variable
to evaluate it.)
>
save UGCData in "Studio!:Studio Files:Internet:HLP :Local
>
Pages:UGC.html"
>
end tell
>
>
>
Entourage allows an 'as' parameter for saving, to specify file type,
>
but its dictionary is not forthcoming about what exactly to specify. If
>
no 'as' parameter is set (as in the above example), the message is
>
saved as an Entourage mail file (type "M822"). If I add 'as text' to
>
the save command, I get just the displayed text from the message, with
>
no formatting or html content. I tried 'as HTML', which Entourage
>
didn't understand, and 'as web page', which returned an error. So
>
either there's a simple bit of terminology that I've been unable to
>
figure out, or I'm driving down a dead end - in which case, there's got
>
to be a harder way, right?
It sure would be easier to save as an .eml which opens in Entourage, yes.
When you save, don't save in a folder - save in a filepath of the
file-to-be. (And it has to be Unicode text or string, NOT 'file', since that
conflicts with Entourage's own 'file' keyword. The text path will be coerced
by AppleScript to what's used as a file specification nowadays.)
Will this do? You can filter for messages of the correct subject from the
rule itself (or do it here). You need to add checks that you don't already
have a message with the identical subject already saved to the same folder.
One way would be to add a unique date/time stamp to the name of the file. Or
else you can do complicated filepath-checking routines and add an
incrementing number to the name, which is tricky.
tell application "Microsoft Entourage"
set theMsg to item 1 of (get current messages)
set theSubject to subject of theMsg
save theMsg in ("Studio!:Studio Files:Internet:HLP :Local Pages:" &
theSubject & ".eml")
end tell
That gets you a file that will double-click into beautiful HTML glory back
in Entourage (or whatever your email client might be if you change its file
association in Get Info).
--
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.