2 Replies Latest reply on May 29, 2013 7:54 AM by shilpa25

    Move using selected width

    shilpa25 Level 1

      Hello forum,

       

      I have a textFrame(1) inside document,

       

      and i have a another textFrame(2) selected.

       

      Help, i needed is to; move the textFrame(1) X & Y position.

       

      The  textFrame(1) X & Y should be : width of the textFrame(2) / 100*8.

       

      eg. width of the textFrame(2) is 200. so 200/100*8 = 16;  so the x is 16 and y is 16.

       

      i tried below code.

       

      allf.horizontalScale = app.selection[0].horizontalScale/100*8;

      allf.move([app.selection[0].horizontalScale/100*8,  app.selection[0].horizontalScale/100*8]);

       

      Could anybody help on this please..

       

      thanks & regards....

        • 1. Re: Move using selected width
          Vamitul Level 4

          hi Shilpa!

           

          The first thing i see, you are trying to use horizontalScale as width, and that's just wrong.

          The wierd part is that the indesign DOM has no width or height property for objects. One simple way to get around it is to use the geometricBounds property. For example

           

          var width=myTextFrame.geometricBounds[3]-myTextFrame.geometricBounds[1];

          var height=myTextFrame.geometricBounds[2]-myTextFrame.geometricBounds[0];

           

          ofcoursse things can get a lot more complicated than that. Marc has an very interesting article here: http://www.indiscripts.com/post/2009/10/work-around-the-width-height-gap (warning!! a lot of math and his trademark hard-to read code)

          • 2. Re: Move using selected width
            shilpa25 Level 1

            Hi Vam,

             

            thanks a tonne!.

             

            I have really made a mistake resizing and moving using scale options..

             

            as usual, you ROCKS!.

             

            thanks for your guidance.... VAM..

             

            regards.

            Shil...

            1 person found this helpful