This should be really easy ... but I can't do it!
I want to assign a hotkey so I can, via AppleScript, open a new
document from an existing template (like the File > Project Gallery >
My Templates > choose-and-click)
Actually, this (the hot key part) is not something that can be done just be
AppleScript at the moment. Word does not have its own script menu with a
mechanism for adding keyboard shortcuts, like Entourage does. You have to
run scripts either as self-standing script applications (applets), which
you'd double-click or put into the dock and single-click, or as a .scpt
script from the system's script menu. The system's script menu also does not
have a hotkey mechanism. You'd need to get a 3rd-party utility such as iKey,
QuicKeys, or DragStuff, that can set up hotkeys for scripts and other apps.
(I think in this case only for script applications, which are always slow to
launch, like any application. But I might be wrong - perhaps one or the
other of them can also load and run a .scpt script, which would be faster.
Check out DragStuff in particular.)
Similarly, there's currently no way to use Tools/Customize to assign a
Keyboard Shortcut (hotkey) to a script: that - and a script menu - is
something you should request here for a later Word version. However, if you
wrote it as a VBA macro, you _could_ assign a hotkey that way.
I'm assuming what you want is to specify one particular template as the one
to make a new document from? You'd just press the key combo and get that
document opening? (You'd need a different key combo for each such template.
Lots of key combos to remember.) If you actually want to "choose-and-click"
from different templates in My Templates, why not just use the built-in
combo cmd-shift-P to open the Project Gallery? Yes, there's that one more
step of clicking My Templates, but that's not such a big deal.
There's no way to script opening just My Templates in the Project Gallery
itself, I don't think. There is something called "GUI Scripting" - a
not-very-reliable method of simulating clicking and menu-choosing by
AppleScript in Panther and Tiger, which works for Cocoa applications and
some Carbon apps - but doesn't work at all for MS Office apps (except menu
items, only, in Entourage; nothing at all in Word).
If from all this, there's something you'd like to do that does involve a
script or macro, say which, an maybe there's something that can be done.
--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <
http://www.entourage.mvps.org/faq/index.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 Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.