Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

Actions/Scripts: Move layer to absolute position instead of translate

$
0
0

Hey all,

 

Im trying to write a script which takes a layer and moves it to a x/y coordinate on the canvas rather than translates the object a certain amount of pixels. Ive created an action so far and converted it to a script file to try and tweak it but am having trouble understanding the API. I was hoping someone here might be able to help.

 

Here is the step that I need to adjust from a translate to an absolute position:

 

 

  // Transform

 

  functionstep9(enabled, withDialog) {

   if (enabled != undefined&& !enabled)

   return;

   vardialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

   vardesc1 = newActionDescriptor();

   varref1 = newActionReference();

   ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));

   desc1.putReference(cTID('null'), ref1);

   desc1.putEnumerated(cTID('FTcs'), cTID('QCSt'), sTID("QCSAverage"));


   vardesc2 = newActionDescriptor();

   desc2.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 0);

   desc2.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), 1800);

   desc1.putObject(cTID('Ofst'), cTID('Ofst'), desc2);


   vardesc3 = newActionDescriptor();

   desc3.putEnumerated(sTID("warpStyle"), sTID("warpStyle"), sTID("warpNone"));

   desc3.putDouble(sTID("warpValue"), 0);

   desc3.putDouble(sTID("warpPerspective"), 0);

   desc3.putDouble(sTID("warpPerspectiveOther"), 0);

   desc3.putEnumerated(sTID("warpRotate"), cTID('Ornt'), cTID('Hrzn'));

   desc3.putInteger(sTID("uOrder"), 4);

   desc3.putInteger(sTID("vOrder"), 4);

   desc1.putObject(cTID('warp'), cTID('warp'), desc3);

   desc1.putEnumerated(cTID('Intr'), cTID('Intp'), cTID('Bcbc'));

   executeAction(cTID('Trnf'), desc1, dialogMode);

  };

 

 

Thank you in advance for the help!


Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>