Actions/Scripts: Move layer to absolute position instead of translate
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:
function step9(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
desc1.putReference(cTID('null'), ref1);
desc1.putEnumerated(cTID('FTcs'), cTID('QCSt'), sTID("QCSAverage"));
var desc2 = new ActionDescriptor();
desc2.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 0);
desc2.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), 1800);
desc1.putObject(cTID('Ofst'), cTID('Ofst'), desc2);
var desc3 = new ActionDescriptor();
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!
