Copy link to clipboard
Copied
Hello all,
I feel like this should be a "duh" thing but I've tried everything I can think of and have come up empty.
Attempting to apply a master page to all the pages in my document in a script. I am aware that this is easy to do in InDesign, but we have a multi-step script that needs to include this step. The code below applied the master page to the first page, but does not work for multi-page documents.
app.documents[0].pages[0].appliedMaster = app.documents[0].masterSpreads.item ('GGS-Master');
Also, if you can suggest a source for looking up javascript terms, I'd appreciate it!
Thanks,
Amanda
Hi Amanda,
you could work with method everyItem() to access all document pages:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Pages.html
So your code could be written like that:
app.documents[0].pages.everyItem().appliedMaster =
app.documents[0].masterSpreads.item('GGS-Master');
InDesign's vast document object model ( DOM ) description compiled by Gregor Fellenz:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#about.html
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi Amanda,
you could work with method everyItem() to access all document pages:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Pages.html
So your code could be written like that:
app.documents[0].pages.everyItem().appliedMaster =
app.documents[0].masterSpreads.item('GGS-Master');
InDesign's vast document object model ( DOM ) description compiled by Gregor Fellenz:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#about.html
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Thank you very much, @Laubender! I was so close and this was perfect.