Copy link to clipboard
Copied
Hello,
I have a script that process, save and close some documents.
I'm having some problems when I launch it using the "startup script" folder: when the script tries to close documents using the standard function myDocument.close(SaveOptions.NO), the documents aren't closed.
But, if I launch the same script with ExtendScript Toolkit, documents are closed correctly.
Any thoughts?
Thank you
Copy link to clipboard
Copied
Hi,
Paste a code pls.
How your code is calling/refering to myDocument?
Jarek
Copy link to clipboard
Copied
Hi Jarek,
it's difficult to paste the entire code because I'm including external libraries, but I'm using the app.open() function in this way:
var templateFullName = File("C:/template.indt");
var myDoc = app.open(templateFullName, false);
//Some stuff
//...
myDoc = myDoc.save(File("C:/output.indd"));
myDoc.close(SaveOptions.YES);
Copy link to clipboard
Copied
Hi,
I've just simplified my code with this one and tested it with both "Startup script" folder and Extendscript Toolkit
#target "indesign-11.064"
var doc = null;
for(var i = 0; i < 10; i++) {
doc = app.open(File("C:/ScriptTest/INPUT/template.indt"), false);
doc = doc.save(File("C:/ScriptTest/OUTPUT/" + i + ".indd"));
doc.close(SaveOptions.YES);
$.sleep(2000);
}
This is the result just before the script completed:
This one after the script completed:
It seems that documents have been closed at the end of the process.
But I'm not able to find why it happens, because using the toolkit, every document is closed immediately.
Thank you for your help