4 Replies Latest reply on Jan 9, 2017 4:53 AM by mig90501573

    Help with indesign script


      Hello everybody I need help and I am sure somebody will have an answer to it. I need to print large an indesign document that has hundreds of pages, however I need to print a color spread every 8 pages to function as a separator. Now instead of manually enter the spread manually every 8 pages I would like to know if there is a way to do this automatically, maybe a script, this would really help.

        • 1. Re: Help with indesign script
          vinny38 Level 5


          maybe something like this might help :


          var doc = app.documents[0];
          var masterNames = doc.masterSpreads.everyItem().name;
          var d = app.dialogs.add({name:"pick a master spread"});
          d.dialogColumns.add().staticTexts.add({staticLabel:"Master Pages:"});
          var dd = d.dialogColumns.add().dropdowns.add({stringList:masterNames});
               var index = dd.selectedIndex;
          } else {
          var master = doc.masterSpreads.item(index);
          for(var i=6;i<=doc.pages.length;i+=8){


          Based on https://forums.adobe.com/message/3223771#3223771#3223771

          • 2. Re: Help with indesign script
            mig90501573 Level 1

            Hey thanks for your fast answer, I am very new to scripts and in fact I have no idea how to make one out of what you wrote, can you please tell me how to make one with the code you sent?

            • 3. Re: Help with indesign script
              vinny38 Level 5


              copy/paste the code into a code editor.

              I recommend you use Adobe ExtendScript Toolkit.


              Then save and name the script file in javascript format here : [...]Adobe InDesign\Scripts\Scripts Panel.

              Finally, in Indesign, choose Window > Utilities > Scripts.

              Double-click or right-click to execute the script.

              That's it.


              The script above inserts a new page, based on a Master page, every 8 pages.

              Further explanation for Line 15 :

              for(var i=6;i<=doc.pages.length;i+=8){


              i=6 means script will start including new page AFTER page 7 (looks strange but note that javascripts starts counting at... 0!)

              i+=8 means it will repeat the operation every 8 pages. So the result here will be pages 8, 16, 24, 32... will be inserted.

              Understanding that, you might have to modify the code, depending on how you want it to act.


              Hope that helps


              Please note there is a specific indesign scripting forum here: InDesign Scripting

              • 4. Re: Help with indesign script
                mig90501573 Level 1

                Awesome! this solved it, you just help me save a lot of work! thank you very much!