Auto loading applescripts?

H

heysakshi

Hi,

I have written some helper VBA macros which execute at Word's launch
time. I have been using the AutoExec module to auto-launch/invoke them.

Now that Office Apps will no longer support VBA, I have been thinking
of gradually moving on to AppleScript. Unfortunately, I could not
figure out a corresponding technique for AppleScript. Does one even
exist?

thanks!
 
D

Daiya Mitchell

I don't *think* an AutoExec-equivalent has been implemented into Word's
AppleScript yet, although you might search this group to see if Paul
Berkowitz (currently *the* Office AS guru) has mentioned it anywhere. He'll
likely come confirm at some point.

However, in the meantime, you should be sure to use Help | Send Feedback to
make sure that the MacBU knows how important the AutoExec functionality is
to you. Explain how you use it.

As a macBU blogger asked:
We¹d like to know what you do with VB, what the goal was, did you share the
macro with anyone, was it specifically cross-platform or just something on the
Mac, what app was the macro in, and things like that.
<http://www.schwieb.com/blog/2006/08/10/so-tell-us-what-you-want-what-you-re
ally-really-want>
The more they know about what people need, the better a product we're likely
to get in future versions.
 
J

John McGhie [MVP - Word and Word Macintosh]

Does AppleScript have an "Event Handler"? Word posts a huge variety of
"events" to the system: among them is "DocumentOpen" which you could hook to
fire your AppleScript.

Cheers


Hi,

I have written some helper VBA macros which execute at Word's launch
time. I have been using the AutoExec module to auto-launch/invoke them.

Now that Office Apps will no longer support VBA, I have been thinking
of gradually moving on to AppleScript. Unfortunately, I could not
figure out a corresponding technique for AppleScript. Does one even
exist?

thanks!

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consultant
Technical Writer.
Sydney, Australia +61 (0) 4 1209 1410
 
P

Paul Berkowitz

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.
 
J

John McGhie [MVP - Word and Word Macintosh]

You already have :) They're in here every day, they just don't say much
:)


Thanks! I'll try and contact the MS support team with the request.

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consultant
Technical Writer.
Sydney, Australia +61 (0) 4 1209 1410
 
D

Daiya Mitchell

But Nadyne specifically said that comments through the Feedback site are
most likely to get counted and recorded properly. I'm all about redundancy,
myself.
http://blogs.msdn.com/macmojo/archive/2006/09/01/735586.aspx

Paul, thanks for those excellent points about the dangers of Auto macros.
Though I requested them anyhow.

By the way, when you send Feedback, do explain the purpose of your VBA--the
MacBU might take a different road to the same functionality.


You already have :) They're in here every day, they just don't say much
:)
<snip>
 
J

John McGhie [MVP -- Word and Word Mac]

Hi Daiya:

Yeah, we need to be careful how we do this. Hopefully the next version of
Office Mac will also bring us proper Digital Rights Management. This means
an industrial-grade encryption engine (no more crackable document
passwords...) and the ability to impliment Code Signing.

Code Signing causes the system to prompt the user whether or not to trust
XYZ macro or UVW Developer. So I can choose to trust anything signed by
Apple, or only selected applications signed by Microsoft. Trusted
applications or scripts can run. Anything *else* will prompt if it's signed
with a verifiable signature, or be silently ignored.

Cheers
 

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