• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How do I designate all pages for an AppliedMaster script?

New Here ,
Aug 31, 2021 Aug 31, 2021

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

TOPICS
How to , Scripting

Views

165

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 31, 2021 Aug 31, 2021

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 )

Votes

Translate

Translate
Community Expert ,
Aug 31, 2021 Aug 31, 2021

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 )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 31, 2021 Aug 31, 2021

Copy link to clipboard

Copied

LATEST

Thank you very much, @Laubender! I was so close and this was perfect.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines