Skip to main content
mig90501573
Participant
January 9, 2017
Answered

Help with indesign script

  • January 9, 2017
  • 1 reply
  • 662 views

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.

This topic has been closed for replies.
Correct answer vinny38

Hi

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

Vinny

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

1 reply

vinny38
Legend
January 9, 2017

Hi

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

if(d.show()){

     var index = dd.selectedIndex;

     d.destroy();

} else {

     d.destroy();exit();

}

var master = doc.masterSpreads.item(index);

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

     doc.pages.add(LocationOptions.AFTER,doc.pages,{appliedMaster:master});

     };

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

mig90501573
Participant
January 9, 2017

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?

vinny38
vinny38Correct answer
Legend
January 9, 2017

Hi

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

Vinny

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