2 Replies Latest reply on Oct 23, 2016 11:41 AM by cmoke73

    textframe width : get it - check minimum - apply new

    cmoke73 Level 1

      Hi!

       

      I´ve written a simple script wich becomes part of a bigger one. Unfortunately it doesn´t work. And I cannot see the fault.

      Okay, I´m a rookie, but this should not be too sophisticated.

      var Auswahl = app.selection[0];   
           var rA=Auswahl.rotationAngle;
           Auswahl.rotationAngle=0;
          //var pName = Auswahl.parentPage.name;
          var Koordinaten = Auswahl.geometricBounds;
          var y0 = Koordinaten[0];
          var x0 = Koordinaten[1];
          var y1 = Koordinaten[2];
          var x1 = Koordinaten[3];
          //var tContent = Auswahl.texts.item(0);
          //do calculations
          var TxBreite = x1 - x0;
          var TxHoehe = y1 - y0;
          
          if (TxBreite < '50') {
              Koordinaten[3] = Koordinaten[1]+'50';
           }
          //alert(Koordinaten[0]+" - "+Koordinaten[1]+" - "+Koordinaten[2]+" - "+Koordinaten[3]);
      
         alert("Die Breite beträgt: "+TxBreite +"mm. \nDie Höhe beträgt: "+TxHoehe+"mm.");
      

       

      The task is simple: select a textframe, get its width and height, if the width is less 50mm make it 50mm wide!

      where is the bug?