3 Replies Latest reply on Jul 21, 2010 12:24 AM by eboda_snaf

    JS: Item coordinates and sizes

    eboda_snaf Level 1

      I've tried using both visibleBounds and geometricBounds to get a item coordinates and size on page..

      it will give me a strange results such as10.6413765606047, -2.93075, 179.358623439395, 202.93075

       

      The item's actual coordinate on page is just x=0mm, y=20mm, W=200mm and H=150mm shown on the panel,

      how can i get the item's actual coordiante as of the panel's?

       

      can anyone please advise? Thanks alot!!

        • 1. Re: JS: Item coordinates and sizes
          Peter Kahrel Adobe Community Professional & MVP

          The script languages show measurements in credit-card number size decimals, that's ok.

          To check the reported bounds against what you see in the Transform panel, select the top-left anchor to check the first two values of the geometric bounds, the bottom-right one to check the last tw values of the bounds. Also bear in mind the Transform panel gives you x and y values of the selected anchor and the width and height of the frame whereas the geometricBounds gives you top, left, bottom, and right of a frame, so that you need to calculate the width and height.

           

          Peter

          1 person found this helpful
          • 2. Re: JS: Item coordinates and sizes
            PankChat Level 1

            Well what Peter has suggested is correct. You will getting the top, left,

            bottom, right coordinates of an object.

             

            I normally use to set my rulers to "mm" for better view or calculations

            for such purposes. Depends upon choice

             

            //Set the ruler option at zero point and change measurement units to mm

             

            var myDoc=app.activeDocument

            myDoc.zeroPoint = Array(0,0)

            with (myDoc.viewPreferences)

            {

                    var myOldXUnits = horizontalMeasurementUnits;

                    var myOldYUnits = verticalMeasurementUnits;

                    horizontalMeasurementUnits = MeasurementUnits.millimeters;

                    verticalMeasurementUnits = MeasurementUnits.millimeters;

            }

             

            Cheers.........

            • 3. Re: JS: Item coordinates and sizes
              eboda_snaf Level 1

              Thanks to both of u!!....

               

              cheers..