No, it does not. That's the biggest lack of AppleScript compared to VBA
macros. As Daiya says, you can request it. (Microsoft are well aware of the
lack - I do not know what they have planned, or not.)
The major impediment to implementing an AutoMacro in AppleScript is that
there is currently no mechanism of any type to embed a script inside a
document. Scripts are always independent files of one type or another.
Therefore they cannot be associated with a document, even if they are stored
in a special location. (At the moment, there's no special Script menu for
Word to run scripts either, as there is in Entourage. Not that that really
matters, unless it could also somehow be used to associate script files with
documents. I cannot imagine how.)
I answer to John's query, AppleScript can indeed implement even handlers,
but very, very applications currently do so. (If an application is called
"attachable", that's what it means, more or less.) In those few cases, it is
what makes the application itself customizable - for example a button on a
toolbar could be intercepted when clicked by a user, and some command
effected. AppleScript Studio is a way that developers can create their own
Cocoa applications which do just that too, using AppleScript. I think that
it's more likely that some such mechanism might be implemented for Word than
AutoMacros.
But (since I really do not know anything yet), I can't imagine how
AutoMacros could be done. Maybe there could be a new menu item in the Tools
menu "Attach a Script", to attach or embed a script in a document. If so,
there might also be a mechanism that scanned the script when the document
was opened for some sort of 'on AutoOpen()' handler they could define in the
dictionary.
Do be ware that this could be a power for evil as well as good. Just as
Office macros enabled a whole plethora of viruses, so could this method.
Only the capability of doing harm would be even greater, since AppleScript
is a Mac-wide language: the malicious script could be written to do damage
to virtually anything at all on your computer. At the very least, it would
have to accompanied by a mechanism that also called up an alert to let you
disable the script, just as for macros now. This would be quite an enormous
endeavour, and might still lead to lots of problems that Microsoft could be
blamed for, when people don't disable the scripts of documents they are
sent.
The former developer of Entourage once told me that he had specifically
chosen not to make Entourage "attachable" in the sense of letting a scripter
write scripts to intercept the Send Message button, etc. since it could be
too powerful. And that's nothing compared to automatically-running scripts
in documents you receive by email. I'm not convinced it's a good idea.
--
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.