Automatic "Save" and "Close" when using "afterOpen" eventListener?
Hi,
Anyone so kind as to help me out with this problem, please?
I wish to launch Indesign and open a specific file externally.
I have a startup script :
#targetengine "onAfterOpen"
main();
function main(){
var myListener=app.eventListeners.add("afterOpen", myfunc);
}
function myfunc(myEvent){
var doc=myEvent.parent;
if (doc.name=="theProject.indd"){
myEvent.target.windows.add();
var myFile = new File('C:/script_to_run.jsx');
app.doScript(myFile);
doc.save(); //does not work
doc.close(); //does not work
}
}
After the file is open the startup script triggers another script to run and after that I would like to "Save" and "Close" the file automatically but I get a warning message saying: "Cannot save/close document because there are open transactions in process on the database."
Any help would be appreciated
