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

Need help to script MasterSpread page count

New Here ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

Hello, I need some help to understand how to script the number of pages in the master page to 1.

 

I keep having to manually set the page count to 1, so I'd like to see if there was a way to script this?

Screen Shot 2021-06-30 at 11.48.35 AM.png

 

TOPICS
Scripting

Views

198

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 , Jun 30, 2021 Jun 30, 2021

If you intend to delete the pages in a spread you can use something like the following

app.documents[0].masterSpreads.itemByName("A-Master").pages[-1].remove()

This will remove the last page of the master spread named A-Master. If the masterspread has only a single page the above code removes the masterspread totally. So you could iterate the masterspreads and delete pages until it's left with only a single page

-Manan

 

Votes

Translate

Translate
Community Expert ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

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
Community Expert ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

LATEST

If you intend to delete the pages in a spread you can use something like the following

app.documents[0].masterSpreads.itemByName("A-Master").pages[-1].remove()

This will remove the last page of the master spread named A-Master. If the masterspread has only a single page the above code removes the masterspread totally. So you could iterate the masterspreads and delete pages until it's left with only a single page

-Manan

 

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