5 Replies Latest reply on Sep 22, 2014 8:21 AM by Zelman

    Tweaking a script to complete transform and also add scale variables




      I am trying pick up bit and pieces on how to script photoshop. For the most part I can do what I need by mixing it with applescript. My current issue is taking a layer, setting the anchor point to set specific location (see below), scale it and complete the task with no user interaction. I found the below script which which will let me pass variables to set the anchor points (sweet). Now I am wondering if anyone can help me figure out how to add two more variable for the scaling. Since I am passing variable I don't need user interaction which this current script seem to want.


      Part one: Set Anchor points — Done

      Part two: Scale layer — Not sure

      Part Three: Turn off user interaction — I am think I just need to change line 15 "DialogModes.ALL" > "DialogModes.NO"  Can anyone confirm?


      Any help would make my life a lot easier. I have to scale an image 10,000 times and this is the only thing holding me up.


      function transform( x, y) {// anchor position as pixels  
          var desc = new ActionDescriptor();  
              var ref = new ActionReference();  
              ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );  
          desc.putReference( charIDToTypeID('null'), ref );  
          desc.putEnumerated( charIDToTypeID('FTcs'), charIDToTypeID('QCSt'), charIDToTypeID('Qcsi') );  
              var desc7 = new ActionDescriptor();  
              desc7.putUnitDouble( charIDToTypeID('Hrzn'), charIDToTypeID('#Rlt'), x );  
              desc7.putUnitDouble( charIDToTypeID('Vrtc'), charIDToTypeID('#Rlt'), y );  
          desc.putObject( charIDToTypeID('Pstn'), charIDToTypeID('Pnt '), desc7 );  
          desc.putUnitDouble( charIDToTypeID('Wdth'), charIDToTypeID('#Prc'), 100 );  
          desc.putUnitDouble( charIDToTypeID('Hght'), charIDToTypeID('#Prc'), 100 );  
          desc.putBoolean( charIDToTypeID('Lnkd'), true );  
          desc.putEnumerated( charIDToTypeID('Intr'), charIDToTypeID('Intp'), charIDToTypeID('Bcbc') );  
          executeAction( charIDToTypeID('Trnf'), desc, DialogModes.ALL );  
      transform( 584, 330) //looking for add variables for the x, y scale box