2 Replies Latest reply on Apr 15, 2016 11:42 AM by fraiquin

    Have a layer resize script, but need it to work when layer is great than 550px




      I've luckily found a script that does a layer resize just what was needed. Only thing is, I want the script to only deploy if that current layer is greater than 550px - existing code for the script is below:


      (function (){
          var startRulerUnits = app.preferences.rulerUnits;  
          app.preferences.rulerUnits = Units.PIXELS;
          var bounds = activeDocument.activeLayer.bounds;  
          var width = bounds[2].value - bounds[0].value;
          var newSize = (100 / width) * 550;  
          activeDocument.activeLayer.resize(newSize, newSize, AnchorPosition.BOTTOMLEFT);
          app.preferences.rulerUnits = startRulerUnits;  


      If anyone can explain how I can use an If function, would be much appreciated!


      Many thanks in anticipation.