2 Replies Latest reply on Apr 24, 2013 10:26 PM by BEGINNER_X

    Need all textframes in equal width and height

    BEGINNER_X Level 3

      Hi All,

       

      Request:

       

      I need all the text frames in equal width and equal height in my active document.

       

      Trying code:

       

      var myDoc = app.activeDocument

      var myTF = myDoc.textFrames.everyItem().getElements()

      alert(myTF.length)

       

      app.activeDocument.viewPreferences.horizontalMeasurementUnits = app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;

       

       

      for(k=0; k<myTF.length; k++)

      {

          myTF[k].geometricBounds[3] = myTF[k].geometricBounds[1]+125    //Doubt this line

          alert(myTF[k].geometricBounds[3])

          }

       

      Could anyone give solution for my request.

       

      Thanks

      Beginner_X

        • 1. Re: Need all textframes in equal width and height
          Jump_Over Level 5

          Hi,

           

          You can edit geometricBounds as a whole array - not as a particular [x] element. So to change object position use:

           

               object.geometricBounds = YourNewArray;     //      [y,x,Y,X]

           

          but in THIS case better way is to use:

           

               object.resize(

                      CoordinateSpaces.INNER_COORDINATES,

                      AnchorPoint.TOP_LEFT_ANCHOR,

                      ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,

                      [ mWidth, mHeight] );

           

          Jarek

          1 person found this helpful
          • 2. Re: Need all textframes in equal width and height
            BEGINNER_X Level 3

            Hi Jump_Over,

             

            I got this below lines.

             

            var myDoc = app.activeDocument

            var myTF = myDoc.textFrames.everyItem().getElements()

             

            for(i=0; i<myTF .length; i++)

            {

                myStoreBounds = myTF[i].geometricBounds 

               

                myTF[i].geometricBounds = [myStoreBounds[0], myStoreBounds[1], myStoreBounds[2], myStoreBounds[1]+120]

                }

             

            Could you suggest or provide any better coding.

             

            Thanks

            Beginner