Is there an AppleScript for Word 2004 to capture the message content(HTML)
or text (plain text) from the frontmost Entourage message window or the
currently displayed message and then paste the text/content in an open Word
document window?
Plain text is easy enough. HTML is not scriptable in Entourage.
(Theoretically, you could get the HTML coding from the HTML part of the
source of the message. There may be a way of using the same HTML code to
make a Word HTML file, then open it as a Word doc. I have a glimmer of an
idea as to how that might barely be possible - I'll try it later.) To get
the plain text (which will work also with HTML messages), it makes a
difference as to whether the Entourage "message" is one you received, or a
new message window you've composed but haven't sent yet. I'll assume it's
the former (received message).
tell application "Microsoft Entourage"
if class of front window is message window then
set theMsg to displayed message of front window
else
try -- if message is displayed in main window
set theMsg to item 1 of (get current messages)
on error
beep
return
end try
end if
set theContent to content of theMsg
end tell
tell application "Microsoft Word"
activate
-- for inserting in an open doc at the cursor, delete next two lines and
remove (* *) from following lines
set theDoc to make new document
set content of text object of theDoc to theContent
(*set theDoc to active document
set selection to theContent *)
end tell
I'd recommend saving this as a compiled script and saving it to here:
~/Library/Scripts/Applications/Microsoft Word/
or here:
~/Library/Scripts/Microsoft Word/
The first method will display the script as a menu item at the bottom of the
system's Script Menu only when you're in Word (handy if that's where you'll
be using it : - one click, no clutter in other apps). The second method will
put it as a submenu item in a "Microsoft Word" menu item in the Script Menu,
and will be available everywhere, no matter which app you're in.
To make the system script menu visible, go to
/Applications/AppleScript/Install Script Menu and double-click it. (Word
doesn't have its own script menu, unfortunately, but this isn't too bad. It
will run a lot faster than saving the script as an Application.) The script
menu looks like Entourage's but is on the right side of the menu bar, near
the other doodads. If you install it first, you can get direct to your user
Scripts folder above by selecting "Open Scripts Folder" at the top of the
menu.
--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <
http://www.entourage.mvps.org/toc.html>
AppleScripts for Entourage: <
http://macscripter.net/scriptbuilders/>
Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.
PLEASE always state which version of Entourage you are using - **2004**, X
or 2001. It's often impossible to answer your questions otherwise.