AppleScript to create a document based on a custom template???

S

Scott Ribe

I have a custom template which is (partially so far) working. Now I would
like to have an AppleScript that does exactly what select my template in the
Project Gallery does. However:

make new document with properties {attached template:...

Creates a document that shows the template attached in document properties,
but does not run the Document_New event handler that's in the template for
ThisDocument. (It does run when creating from the project gallery.)

I figured out that I can do this with Do Visual Basic and:

Documents.Add Template:=...

But is there really no way to do this more directly with AppleScript?

Also, the Do Visual Basic "Documents.Add ..." approach fails if the Project
Gallery is displayed. So if MS Word is not already running, and I haven't
turned off display of the Project Gallery at startup (or the user has turned
it back on), this fails. Is there any way to detect that and close it? It
doesn't seem to show up as the active window...
 
J

JE McGimpsey

Scott Ribe said:
I figured out that I can do this with Do Visual Basic and:

Documents.Add Template:=...

But is there really no way to do this more directly with AppleScript?

That's the way to do it - not being able to set properties via

make new document with properties {...

is a bug. There have been assurances that this will be fixed in
Word2008, but of course, there won't be any event handlers fired in that
version since VBA is going away.

I'm starting to migrate chunks of my startup add-in and document
template auto macros to automator actions so that they will (I hope)
work the same way in both Word2004 and Word2008.
 

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