Here's a script that lets you flip your message reply and signature placement from top to bottom, or vice-versa, on a per-message basis. People send you e-mail replies in which some may reply at the top, and some may reply at the bottom. This script helps clear the confusion when writers hinder the message's continuity by switching between top and bottom. Although you have chosen your preferred method in Microsoft Entourage Preferences, you can run this script if you want your reply to be different than your regular preference.
First you have to set it up. You do this by setting the properties at the top of the script. One version of this script sets these properties by running a separate PREFS script, which uses the standard scripting addition commands load script and store script to change the values of the properties in the main script.
However, that won't work in Entourage 2004 with scripts made using Macintosh Script Editor. For more information about data fork and resource fork scripts, see About the Script menu.
More importantly, as a scripter, you can set the properties the way you want in Script Editor, and they will work. If you ever want to change the properties, just open the script in Script Editor, and then change and save them.
You can add a keyboard shortcut to the script name, which is particularly handy for this script, and put it in the Entourage Script menu. Here are the four properties that go at the top of the script:
property replyUsingMessageFormat : true property htmlText : true property attributionStyle : "short headers" -- or "internet" or "none" property insertionPointOnTop : false --(only applies to internet-style)
The first two properties, replyUsingMessageFormat and htmlText, are for indicating whether you want to reply in the same format (that is, plain text or HTML) as the original message, or whether you always want to reply in one or the other. This should be the same as you set it in the Entourage Compose Preferences. AppleScript cannot access those preferences so you need to set them here.
If you set replyUsingMessageFormat to true, then also set htmlText to true. If you set replyUsingMessageFormat to false, set htmlText to whichever you want (false if you want plain text always). If your usual attribution style in Entourage Reply Preferences is Place reply [quoted] text at top of message and use this attribution line (that is, reply at bottom) and for the script you want the opposite format of Place reply at top of message and include From, Date, To and Subject lines (that is, reply at top with signature at top), set attributionStyle to short headers.
On the other hand, if your usual attribution style is Place reply at top of message and include From, Date, To and Subject lines, you can do the opposite in the script by setting the attributionStyle property to internet. Or, you can set it to none if that's what you want for the script. When you set attributionStyle to internet, you can also choose whether to set insertionPointOnTop to true, which means that you'd be replying at the top. This is the way to get both the internet attribution plus reply-at-top, but it still places the signature at the very bottom, so it is probably not what you want. Or, you can set the insertionPointOnTop property to false (so reply at bottom). Naturally whatever text comes after the double-dashes (--) is just comment and not code.
Here is the whole script when compiled, with the default property values chosen.
property replyUsingMessageFormat : true
property htmlText : true
property attributionStyle : "short headers"
-- or "internet" or "none"
property insertionPointOnTop : false
-- (only applies to internet-style attribution)
tell application "Microsoft Entourage"
try
if window 1 = main window then
set theMsg to item 1 of (get current messages)
else if class of window 1 = message window then
set theMsg to displayed message of window 1
else
error number -128
end if
if class of theMsg incoming message then error number -128
on error
beep
display dialog "You must have a received message in the " & ¬
"front or selected in the message pane of the main " & ¬
"window for the Reply script to work." buttons {"OK"} ¬
default button "OK" with icon 0
return
end try
if replyUsingMessageFormat then
if theMsg's has html then
set htmlText to true
else
set htmlText to false
end if
end if
if attributionStyle = "short headers" then
reply to theMsg attribution style short attribution ¬
html text htmlText
else if attributionStyle = "internet" then
reply to theMsg attribution style internet attribution ¬
place insertion point on top insertionPointOnTop ¬
html text htmlText
else -- no attribution
reply to theMsg attribution style no attribution ¬
html text htmlText
end if
end tellThe first part of the script checks to see whether you are replying to a message viewed in the Preview pane of the main window, in which case it will be the following:
item 1 of (get current messages)
This is because the message viewed in the Preview pane is the message selected in the message list, that is, the first (and only) of current messages. If not, it checks to see if the class (type) of window in the front is a message window (meaning a window that shows a saved message, not a new message draft window), and if so, it gets the displayed message of the window.
It then checks to make sure you have selected or opened a received message by checking for incoming message class. If the front window is neither the main window nor a message window, or if the class of the message is not incoming message, it invokes an error number -128, which is the equivalent of cancel and is thus a safe error to invoke. It then catches it in the
on error
block, displays a dialog box to alert you, and quits the script (return) when you click OK. The reason it goes about it in this fashion (invoking an error instead of just displaying the dialog box and quitting in the appropriate
else
and
if
statements) is so that it catches a true error if there is no window open at all, and so that it only has to call the display dialog box once, no matter which condition causes it.
If all is well, the script continues to the next
if
block to check whether you're replying to an HTML message if your preference is replyUsingMessageFormat, and if so, it sets the htmlText property to true as well. Finally, it moves on to call the reply to command with the appropriate parameters for attributionStyle and htmlText depending on your preferences (set properties).
An optional parameter for the reply to command is opening window, and it is set to true by default so it does not need to be specified. Therefore, a new draft window opens immediately with recipient, quoted text, and attribution. (Setting the opening window parameter to false is the technique to use when you want to set a prepared reply text by the script and just send off the message automatically in the background.)
Save the script to the Entourage Script Menu Items folder in script (.scpt) format, and name it "Reply Insertion Reversed \cmR.scpt " to apply a keyboard shortcut of CONTROL+⌘+R. When adding keyboard shortcuts, you need one or more of the modifier keys: ⌘, OPTION, CONTROL, or SHIFT. Avoid shortcuts that are already used by Entourage, other scripts, or the Mac OS. CONTROL is a good modifier key to include because the built-in Entourage shortcuts virtually never use it.
You can do the same thing and reply to all. Copy and paste the script above into a new script window and add
with reply
to all
to each of the reply to lines at the bottom.
if attributionStyle = "short headers" then reply to theMsg attribution style short attribution ¬ html text htmlText with reply to all else if attributionStyle = "internet" then reply to theMsg attribution style internet attribution ¬ place insertion point on top insertionPointOnTop ¬ html text htmlText with reply to all else -- no attribution reply to theMsg attribution style no attribution ¬ html text htmlText with reply to all end if
You can save this one as "Reply All Reversed \scmR.scpt " to get a SHIFT+CONTROL+⌘+R shortcut.


