5 Replies Latest reply: Aug 14, 2014 6:18 AM by Kenneth Benson RSS

    Reapply all master pages

    Kenneth Benson Community Member

      I'm still on CS6.

       

      I have a large book in which I want to reapply all master pages. Each chapter uses at least 3 masters, so reapplying means selecting a range of pages and applying the same master that's already used, repeat, etc. There are about 30 chapters, so this is going to take a few hours. Is there a script around that goes through a chapter (or, better, a book) and reapplies each page's master page unattended?

       

      Ken Benson

        • 1. Re: Reapply all master pages
          [Ariel] Community Member

          Well, this is untested, but I see that a Page object has a

          removeOverride method. I'm not sure without testing whether calling that

          will be the same as reapplying the master page or not, but you can try

          it and see:

           

          app.activeDocument.pages.everyItem().removeOverride();

           

          that should remove all overrides from all pages in the document, but as

          I say, I'm not sure if that removes the overrides from the pages

          themselves, or from everything on the pages.

           

          If that doesn't work, I suppose one can just loop through the document

          like this:

           

          myPages = app.activeDocument.pages;

          for (i = 0; i < myPages.length; i++) myPages[i].appliedMaster =

          myPages[i].appliedMaster;

           

          Give those a try and report back!

          • 2. Re: Reapply all master pages
            Kenneth Benson Community Member

            The removeOverride method appears to do nothing, but maybe I'm not implementing it correctly. I know only a little about scripts.

             

            Looping through the document, though, does exactly what I wanted it to do. Thanks, Ariel!

             

            Ken Benson

            • 3. Re: Reapply all master pages
              Laubender Community Member

              @Ariel – hm, the documentation about pages says:

              void removeOverride ()

              Removes the override from a previously overridden master page item.

               

              Adobe InDesign CS6 (8.0) Object Model JS: Page

               

              Did not test that, but maybe we have a bug here?

               

              Uwe

              • 4. Re: Reapply all master pages
                [Ariel] Community Member

                I don't have time to play around with this so much right now, but it could be that removeOverride on a doc page removes the overrides on the Page itself (not sure if that makes sense, but perhaps these days with the page tool, it's possible to get a different size page by applying a master with a different size). It doesn't remove the overrides on the pageItems.

                 

                But in any case, it occurred to me that what Ken wanted was to reapply the master, which is not necessarily the same thing as remove all overrides, is it? (for instance, in the case where a master page item has been deleted completely)

                • 5. Re: Reapply all master pages
                  Kenneth Benson Community Member

                  Completely outside of scripting, reapplying a master seems (at least in my case) to be different from removing master overrides. I went into some of the masters and changed margins. My changes don't show on the document pages. From the Pages palette flyout, Master Pages > Remove all local overrides is grayed out. However, Apply Master to Pages . . . causes my new margins to show on all the affected document pages. This was why I was asking about a solution to reapply masters, not remove overrides.

                   

                  Ariel's 3-line script worked great and saved me an hour or two of tediously applying master pages through this 500-page book.