3 Replies Latest reply on May 12, 2017 12:01 AM by Danieled

    Launch script with "Startup script" folder

    Danieled Level 1


      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

        • 1. Re: Launch script with "Startup script" folder
          Jump_Over Level 5



          Paste a code pls.

          How your code is calling/refering to myDocument?



          • 2. Re: Launch script with "Startup script" folder
            Danieled Level 1

            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"));


            • 3. Re: Launch script with "Startup script" folder
              Danieled Level 1


              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"));





              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