You are probably executing your script from ESTK.
If you do, you have to change target application to InDesign
in drop box which is located above your code,
or add this line to your code before session line:
Hope that helps.
I have run one event script using the event "beforeClose". But it throws an error like "The requested action could not be completed because the object no longer exists.".
Some one suggest add the code #targetengine "MySnazzyEngine"; it's working fine in indesign cs5. But Indesign cs3 is not supported in the target engine. How to clear this error?
You're going to have to give more details because CS3 does support engines. (CS2 did not.)
Something else must be the problem...
var myBeforeCloseEvList = app.addEventListener("beforeClose", myBeforeCloseHandler, false);
try the js code in ESTK and check
app.addEventListener("beforeClose", myBeforeCloseHandler, false);
alert("hi to SPi");
This also not supported in indesign cs3.
It won't work from ESTK in CS3 unless you previously create the scripting engine. ESTK in CS3 did not create scripting engines.
Save the script and run from the script panel.
Innovations in Automation