9 Replies Latest reply on Nov 15, 2016 10:22 PM by Willi Adelberger

    Master Page Nightmare!

    Eugene Tyson Adobe Community Professional & MVP

      I'm working on a document at the moment and it has about 100 master pages.


      The person who worked on this before setup the page headers wrong in each of the master pages, different headers for verso and different for recto, probably changed header with a text change when required, however, leaving a master spread with 2 different headings, if a page moves from recto to verso or vice versa, the wrong header is applied.


      Well.. that's the story behind it.


      What I wanted to do was to colour code all the master pages - however, there's only a limited amount of colours available. I basically wanted to see visually where a master page was used in the pages panel by assigning a colour.


      Does anybody know of a way to have more colours available to apply - or even a script that can tell me what master pages are applied to what pages?

        • 1. Re: Master Page Nightmare!
          Laubender Adobe Community Professional & MVP

          Hi Eugene,

          depending on the version of InDesign you are using a script could use arbitrary custom RGB colors to colour code a page.

          ** WARNING **

          Before InDesign CC 2014.2 such a script will force the document to an instable state, if the color labeled page can be seen in the Pages panel:
          InDesign will crash! That's a bug that was fixed with InDesign CC 2014.2.


          So handle with care:


          // Example in ExtendScript:
          // color label all pages of all master spreads with an valid RGB value.
          // Check the version number. If less than 10.2 (InDesign CC 2014.2) do nothing!
          // If the lines below are executed with CC 2014.1 and below InDesign will crash after opening the Pages panel.
          var pageColorLabelColor = [255,255,0]; // RGB values in the form: [r,g,b]
          app.documents[0].masterSpreads.everyItem().pages.everyItem().pageColor = pageColorLabelColor;


          And if you are working with InDesign CC 2014.2 and above, keep in mind not to save back the document you ran that script at!



          1 person found this helpful
          • 2. Re: Master Page Nightmare!
            Eugene Tyson Adobe Community Professional & MVP

            Thanks - that's great! I have version running at the moment.

            • 3. Re: Master Page Nightmare!
              Laubender Adobe Community Professional & MVP

              If you want to switch all page color labels back to none, use:


              app.documents[0].masterSpreads.everyItem().pages.everyItem().pageColor = PageColorOptions.NOTHING;



              1 person found this helpful
              • 4. Re: Master Page Nightmare!
                Eugene Tyson Adobe Community Professional & MVP

                Thanks for that! However, the colour code colours every page yellow, not different colours.

                • 5. Re: Master Page Nightmare!
                  Laubender Adobe Community Professional & MVP

                  Sorry Eugene,


                  obviousl I missed your intention.
                  My fault.


                  One observation when working with scripted custom color labels for:


                  1. Document pages

                  2. Master pages

                  3. Master spreads


                  by using (pseudo code following):


                  1. Custom RGB colors

                  page.colorLabel = [ red value from 0-255 , green value from 0-255 , blue value from 0-255 ];


                  2. Using UIColors

                  With CC 2017 there are 37 UI Colors defined, only 15 of 37 are available in the UI for labeling pages.

                  2.1 page.colorLabel = UIColors.NAME;

                  2.2 page.colorLabel = Enumeration number of a UIColor;


                  Note: If the assigned UIColor corresponds with one of the 15 available UI Colors for page labels, the applied color will show up in the context menu where the page label can be applied as ticked. But one cannot read out the color's name or color's values in the UI if it is not part of the 15 ones. For that we would need an extra script with an interface perhaps showing the color, its value or its name.


                  Having hundreth of different color labels could be confusing because the visible distance from color to color should be big enough to discern a color from the next one as presented in the Pages panel. This can be problematic or impossible for a huge range of masters.



                  What can be done by scripting with not too much effort is to read out the names of the masters that are applied to the pages of a document and write the names to a table of an added document. From there you could copy the result in tabular form to an Excel sheet and do sorting by master names, by page names or absolute page numbering. A text file of the result in tabular form is also possible.


                  // ReadoutOfNamesOfAppliedMastersTo-DocumentPages-SHOW-RESULT-TABLE.jsx
                  // Uwe Laubender
                  * @@@BUILDINFO@@@ ReadoutOfNamesOfAppliedMastersTo-DocumentPages-SHOW-RESULT-TABLE.jsx !Version! Sat Nov 12 2016 13:25:05 GMT+0100
                      1. Reads out the name of applied masters of every page in the active document.
                      2. The results will be stored and added to a table in a new document.
                      The table consists of 3 columns.
                      3. The script will add pages if necessary to show the whole table.
                      The tabular results can be easily copied over to an Excel file 
                      where you can do some sorting.
                      After: Absolute page numbers in the document (default)
                      After: Names of applied masters in alphabetical order
                      After: Page names
                  // If something goes wrong—the story of the resulting table will be in permanent overflow—
                  // the loop for adding pages to the result document will stop after the value of variable
                  // maximumAddedPagesToResultDoc:
                  var maximumAddedPagesToResultDoc = 100; // Should be greater than 1
                  // The active document we gather the information from:
                  var doc = app.documents[0];
                  // Array of all document pages:
                  var pages = doc.pages.everyItem().getElements();
                  var pagesLength = pages.length;
                  // Preparing an array to gather information:
                  // Two top rows of the result table will be prepopulated with:
                  // Row 1: The documnet's name
                  // Row 2: "Absolute Page Number" , "Page Name" , "Applied Master Name"
                  var resultArray = [doc.name, "", "", "Absolute Page Number" , "Page Name" , "Applied Master Name"];
                  // A loop through the pages array:
                  for(var n=0;n<pagesLength;n++)
                      resultArray[resultArray.length++] = (n+1).toString();
                      resultArray[resultArray.length++] = pages[n].name;
                      if(pages[n].appliedMaster == null){resultArray[resultArray.length++] = "[None]"; continue};
                      resultArray[resultArray.length++] = pages[n].appliedMaster.name;
                  // A none-facing pages document 297 x 210 mm will be added to show the results.
                  // Values of document creation can be changed:
                  // From e.g. "297mm" to "210mm", if you want square sized pages.
                  // Or use Points like that: "500pt"…
                  // Also  page orienation can be changed. Simply use:
                  // PageOrientation.PORTRAIT
                  var resultDoc = app.documents.add
                          documentPreferences : 
                              facingPages : false ,
                              pageOrientation : PageOrientation.LANDSCAPE ,
                              pageWidth : "297mm" ,
                              pageHeight : "210mm" ,
                              createPrimaryTextFrame : false
                  // Creates a new text frame on page 1:
                  var resultTextFrame = resultDoc.pages[0].textFrames.add
                          geometricBounds : resultDoc.pages[0].bounds , 
                          fillColor : "None" , 
                          strokeColor : "None" , 
                          strokeWeight : 0
                  // Add a table with three columns to the new text frame:
                          columnCount : 3 ,
                          bodyRowCount : resultArray.length / 3 ,
                          contents : resultArray ,
                          width : resultTextFrame.geometricBounds[3] - resultTextFrame.geometricBounds[1]
                  // If the contents does not fit on page 1, add new pages to the result document until it fits:
                  // Add a text frame to a new page, theread the text frame to the story of the result table.
                  // Adding pages will stop, if:
                  // The story of the table will not overflow anymore.
                  // AND / OR : The maximum value of pages to add is reached.
                  // Whatever happens first. See value of variable 
                  // maximumAddedPagesToResultDoc 
                  // in line 30 of this script.
                  while (resultTextFrame.parentStory.overflows && maximumAddedPagesToResultDoc != 1)
                      var newPage = resultDoc.pages.add();
                      var newTextFrame = newPage.textFrames.add
                              geometricBounds : resultDoc.pages[0].bounds , 
                              fillColor : "None" , 
                              strokeColor : "None" , 
                              strokeWeight : 0
                      resultTextFrame.endTextFrame.nextTextFrame = newTextFrame;



                  1 person found this helpful
                  • 6. Re: Master Page Nightmare!
                    Eugene Tyson Adobe Community Professional & MVP

                    That sounds great. I will give it a go. I'm on a business trip starting Monday but I'll be back Friday to try it.

                    • 7. Re: Master Page Nightmare!
                      Willi Adelberger Most Valuable Participant

                      I think the setup with 100 Masters is not the best method, instead of using 100 Masters do that:

                      1. Use Masters based on other Masters if the most parts are common.
                      2. For pages with different running headers use only one single master, use text variables or section markers in a text frame on the Master.
                      3. Use facing pages.
                      4. Use Paragraph and Object Styles for alignment relative to the spine.
                      • 8. Re: Master Page Nightmare!
                        Eugene Tyson Adobe Community Professional & MVP

                        Yeh if I was the original creator I would have done it a lot differently! I inherited the file!

                        • 9. Re: Master Page Nightmare!
                          Willi Adelberger Most Valuable Participant

                          Did someone kill the guy because he has done it, so you could inherit it?