2 Replies Latest reply on May 24, 2011 4:37 AM by GordonEddey

    How do I script a 3-up master

    GordonEddey

      Hi,

       

      Hope you can help. I am trying to create a three page masterSpread in indesign cs3.

       

      To do this I have used the masterSpreads.jsx script provided by Adobe and then simply added another page, which seems logical to me, but it does not work.

       

      If I create masters using the two page option and then go into Master Options I can add the page manually.

       

      What I really want is to create a 3-up  external masterSpread and a 3-up internal masterSpread - with different global logos and backgrounds for the specfic pages.

       

      These will then wrap around a conventional 2-up inside section, which will have another masterSpread setting.

       

      I have included the code below for reference.

       

      I assume I need to change the master options to increase the number of pages, and have looked on my well-used Jongware reference but I cannot work it out.

       

      Please help.

       

      Regards,

       

      Gordon Eddey

      gordon.eddey@eddit.co.za

       


      HERE IS THE SCRIPT AS IT STANDS:

       

      //Set up the first master spread in a new document.
      myDocument = app.documents.add();
      //Set up the document.

       

      with (myDocument.viewPreferences)
                  {/*doc.viewPreferences*/
                                  horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS
                                  ;  verticalMeasurementUnits = MeasurementUnits.MILLIMETERS
                                  ;  rulerOrigin = RulerOrigin.PAGE_ORIGIN
                                  ;  showRulers = true
                                  ;
                  }

       

      with(myDocument.documentPreferences)
          {
          pageHeight = "297mm"
          ; pageWidth = "210mm"
          ; facingPages = true
          ; pageOrientation = PageOrientation.portrait
          ; pagesPerDocument = 3
          ;
          }
      //Set the document's ruler origin to page origin. This is very important
      //--if you don't do this, getting objects to the correct position on the
      //page is much more difficult.

       

      with(myDocument.masterSpreads.item(0))
      {
      //Set up the left page (verso).
          with(pages.item(0))
          {
          //Add a simple footer with a section number and page number.
              with(textFrames.add())
              {
                  geometricBounds = ["280", "15", "290", "200"]
                  ;
                  insertionPoints.item(0).contents = SpecialCharacters.sectionMarker;
                  insertionPoints.item(0).contents = SpecialCharacters.emSpace;
                  insertionPoints.item(0).contents = SpecialCharacters.autoPageNumber;
                  paragraphs.item(0).justification = Justification.leftAlign;
              }
          }

       

      with(pages.item(1))
          {
              //Add a simple footer with a section number and page number.
              with(textFrames.add())
              {
                  geometricBounds = ["280", "15", "290", "200"]
                  ;
                  insertionPoints.item(0).contents = SpecialCharacters.sectionMarker;
                  insertionPoints.item(0).contents = SpecialCharacters.emSpace;
                  insertionPoints.item(0).contents = SpecialCharacters.autoPageNumber;
                  paragraphs.item(0).justification = Justification.leftAlign;
              }
          }

       

      with(pages.item(2))
          {
              //Add a simple footer with a section number and page number.
              with(textFrames.add())
              {
                  geometricBounds = ["280", "15", "290", "200"]
                  ;
                  insertionPoints.item(0).contents = SpecialCharacters.sectionMarker;
                  insertionPoints.item(0).contents = SpecialCharacters.emSpace;
                  insertionPoints.item(0).contents = SpecialCharacters.autoPageNumber;
                  paragraphs.item(0).justification = Justification.leftAlign;
              }
          }

       


      }

        • 1. Re: How do I script a 3-up master
          milligramme Level 3

          Hi

           

          myDocument.documentPreferences.pagesPerDocument = 3;

          is not for MasterSpread, it's for PageObject.

          So masterSpread[0].pages[2] is not yet existed.

           

          You can fix your code simply rewrite line 58 and try.


           

          GordonEddey wrote:

           

           

          with(pages.item(2))

           

          to

           

          with(pages.add())

           

          thanks

          mg/

          • 2. Re: How do I script a 3-up master
            GordonEddey Level 1

            Hi Milligramme,

             

            Your solution worked instantly. Thanks very much.

             

            I was so busy trying to find a new .item, I never thought of the very logical .add in this case.

             

            I wonder: would it make sense to produce a new master, using the .add for each page, or does one always use the double page master as the parent?

             

            I really appreciate your help.

             

            Regards

             

            Gordon Eddey