Applescript to create new message?

G

glasgowd

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: intel

I am, admittedly, an idiot when it comes to AppleScript, but I can't locate any command in Entourage's dictionary that will create a new message.

I'm trying to create a hotkey for each of my several e-mail accounts, so that I don't have to use the "From" pop-up menu whenever I create a new message... I'm ASSUMING (and vaguely recalling) that there's an AppleScript command that will create a new message with whatever parameters I'd like... am I right?

Thanks,

David
 
D

Diane Ross

I am, admittedly, an idiot when it comes to AppleScript

Me too!. For those that are uncomfortable with AppleScript, Entourage 2008
has added a lot of new actions to Automator. One is create a new message.
It's easy to setup and there is no AppleScript required. However, I have an
AppleScript that I add to mine:

Select Action "Run AppleScript", paste this in to move the new window a bit
off the top left corner.(watch for line wraps)

tell application "Microsoft Entourage"
set theWindows to every window whose class is draft window
repeat with aWindow in theWindows
set position of aWindow to {75, 140}
end repeat
end tell

It is easier though to add a shortcut to a script in Entourage than to the
Automator action in the Finder. FastScripts Lite will do it, but it's
limited to the number you can add shortcuts. The full version is $14.95.
 
G

glasgowd

Wow--that was quick! Thank you both!

Now... I combined those two suggestions and came up with an AppleScript that looks like this:

tell application "Microsoft Entourage"
set myAccount to the first item of (every POP account whose name is "Home")
set myAddress to {display name:"David M. Glasgow", address:"(e-mail address removed)"}
make new outgoing message with properties {sender:myAddress, priority:normal, account:myAccount}
set theWindows to every window whose class is draft window
repeat with aWindow in theWindows
set position of aWindow to {75, 140}
end repeat
end tell

....which works, except that it puts the newly created message in the Drafts folder, rather than opening it so I can actually enter the body of the message.

Am I missing something?

: /
David
 
D

Diane Ross

...which works, except that it puts the newly created message in the Drafts
folder, rather than opening it so I can actually enter the body of the
message.

Try this:

tell application "Microsoft Entourage"
set newMessage to make new outgoing message
open newMessage
set theWindows to every window whose class is draft window
repeat with aWindow in theWindows
set position of aWindow to {75, 140}
end repeat
end tell
 
G

glasgowd

Aha! The message is creating and opening wonderfully now--but if I may be picky.... ;-)

1. Entourage isn't including the default signatures I've assigned to the various accounts. Can I include the signature in the "make" statement somewhere? (Including 'signature type:eek:ther, other signature choice:"Default Work Signature"' doesn't make Entourage happy....)

2. The only HTML boolean I've found in the dictionary is a read-only variable. Can I have AppleScript enable HTML in the newly created message?

Thanks, both, for all of your help! :)
 
W

William Smith

Aha! The message is creating and opening wonderfully now--but if I
may be picky.... ;-)

You might be interested in Paul Berkowitz's VBA Transition guide for
Office 2008.

Don't let the name fool you. Although it's about transitioning from VBA
to AppleScript it includes tons of AppleScript snippets for Entourage
with explanations for just about everything.

You can find it here
<http://www.mactech.com:16080/vba-transition-guide/>. If you don't care
for the magazine subscription then the 145-page guide can be purchased
for $9.95 and downloaded. I refer to it a lot myself. It's worth every
penny and more!

Hope this helps!

--

bill

William M. Smith, Microsoft Interop MVP - Mac/Windows
Entourage Help Page <http://entourage.mvps.org/>
Entourage Help Blog <http://blog.entourage.mvps.org/>
YouTalk <http://nine.pairlist.net/mailman/listinfo/youtalk>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top