3 Replies Latest reply on Feb 18, 2017 3:00 AM by Laubender

    Master page text frame change to primary text frame

    selvam214 Level 1

      Hi All,

      I have trying to add and change the master page's textFrame to primaryTextFrame as below, but can't change to Primary Text Frame. Kindly guide to me.


      Kindly suggest if any alternate method.




      var myDoc = app.documents.item(0);

      myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;

      myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;

      myDoc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;

      myDoc.zeroPoint = [0, 0];

      var m = myDoc.pages[0].marginPreferences;

      var marT = m.top-1;

      var marL = m.left-1;

      var marB = (myDoc.documentPreferences.pageHeight - m.bottom)-1;

      var marR = (myDoc.documentPreferences.pageWidth - m.right)-1;

      var gbounds = [m.top, m.left, myDoc.documentPreferences.pageHeight - m.bottom, myDoc.documentPreferences.pageWidth - m.right];



      var myDoc = app.activeDocument;

      var myMaster = myDoc.masterSpreads;

      for(m = 0; m<myMaster.length; m++){

          if(myMaster[m].name == "TX-Text"){



              var myT = myMaster[m].pageItems;

              for(g=0; g<myT.length; g++){

                  var T0 = Math.round(myT[g].geometricBounds[0]);

                  var T1 = Math.round(myT[g].geometricBounds[1]);

                  var T2 = Math.round(myT[g].geometricBounds[2]);

                  var T3 = Math.round(myT[g].geometricBounds[3]);


                      if(myT[g].textFrames){myT[g] = myMaster[m].primaryTextFrame;}// lacked from here

      //~                 myT[g].textFrames.primaryTextFrame = true;

      //~             alert(T0+" - "+T1+" - "+T2+" - "+T3+"\r"+marT+" - "+marL+" - "+marB+" - "+marR);}

      //~             if(myT[g] == myMaster[m].primaryTextFrame){alert("Y")}











        • 1. Re: Master page text frame change to primary text frame
          Laubender Adobe Community Professional & MVP

          Hi Selva,



          A solution not for InDesign Server

          1. Select a text frame on the master spread.

          2. Run a menuAction to transform a text frame to a primary text frame.

          Lookup the menuAction's name from the context menu after you selected a text frame on a master spread.

          Warning! I tried exactly that, but it crashed my InDesign severely.

          … ( some minutes later : ) …

          Ah. I think I can tell why my InDesign was crashing:

          In the moment I was invoking the menu action the master spread was not the active spread.

          So make sure that the master spread is the active spread!


          Other suggestion that is working:

          Add a new document where you define a primary text frame.

          Duplicate the master spread to your document where you need the primary text frame.

          Use the duplicated master spread instead of the one you already have.


          ( Tested with InDesign CS6 8.1.0 on OSX 10.10.5. )



          • 2. Re: Master page text frame change to primary text frame
            selvam214 Level 1

            Hi Uwe,

            Thanks for the suggestion, i did with menuAction method (invoke).



            app.menuActions.item("Primary Text Frame").invoke();



            Thank you so much this,


            • 3. Re: Master page text frame change to primary text frame
              Laubender Adobe Community Professional & MVP

              Hi Selva,

              I hope that you are spared from crashes.


              Just another comment on the problem:

              DOM documentation is suggesting—at least I do interpret it this way—that one should be able to assign a pageItem ( text frame or text path ) as value to property masterSpread.primaryTextFrame . However, this is not working. It is always throwing an error. The documentation is showing that this property is r/w . Maybe other factors must be in order that this would work, but they are not mentioned.


              I also tried to set the preferences of the document in advance, but this seems to be not sufficient:


              doc.documentPreferences.createPrimaryTextFrame = true;


              For all scripters working with or for locale versions of InDesign, the string for the menu action that should work on all desktop versions of InDesign—e.g. my German version—is: