Skip to main content
Known Participant
March 3, 2010
Question

How to run a script on InDesign startup?

  • March 3, 2010
  • 2 replies
  • 14145 views

How to run a script on InDesign startup?

Or jast after it open one document?

Is there any method like Excel VBA "Auto_Open" ?

This topic has been closed for replies.

2 replies

November 3, 2011

Thank YOU!

i will have my IT guy look at this!

Marc Autret
Legend
March 3, 2010

To make a script autorun on InDesign startup, put the script in a subfolder named "Startup Scripts" (under the app or user Scripts folder).

To make a script run on InDesign document opening, attach an event listener to the beforeOpen or afterOpen document event, e.g. (in JS):

app.addEventListener( "beforeOpen" , function(){alert("Opening a document...");} );

Note that the script must have a session persistence (#targetengine 'mysession') if your event handler is enclosed within. You alternately can put the event handler in an external file, then no session scope is required.

Kasyan Servetsky
Legend
March 3, 2010

To make a script run on InDesign document opening, attach an event listener to the beforeOpen or afterOpen document event...

InDesign's before/afterOpen events are practically useless — they both are sent before the document layout window opens. So you can do nothing useful with the document except perhaps getting its name. The only solution, I know about, is to use APID Toolkit's docLoaded event. If you are interested, here you can find an example of using it.

Kasyan

November 3, 2011

Kasyan wrote last year:

InDesign's before/afterOpen events are practically useless — they both are sent before the document layout window opens. So you can do nothing useful with the document except perhaps getting its name. The only solution, I know about, is to use APID Toolkit's docLoaded event.

As of CS5, you should be able to queue an idle task in response to the open event and then the idle task can wait for whatever condition is necessary before performing its work.


John,

  will that work in CS3?