Hi,
I could not warp the image using javascript from Adobe Extendscript interface. This is what I tried.
1) Created an action with warp, converted the action to jsx using xtools.
2) Used Scriptlistener to record ward and used the javascript.
When the run the code, all the other actions are performed on the image, except warp. Script runs successfully. But warp is not performed.
Here is a sample warp code from Xtools:
function step44(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('#Rlt'), 93.8214587206797);
desc2.putUnitDouble(cTID('Vrtc'), cTID('#Rlt'), -97.3359707022803);
desc1.putObject(cTID('Ofst'), cTID('Ofst'), desc2);
desc1.putUnitDouble(cTID('Angl'), cTID('#Ang'), 45);
var desc3 = new ActionDescriptor();
desc3.putEnumerated(sTID("warpStyle"), sTID("warpStyle"), sTID("warpCustom"));
desc3.putDouble(sTID("warpValue"), 0);
desc3.putDouble(sTID("warpPerspective"), 0);
desc3.putDouble(sTID("warpPerspectiveOther"), 0);
desc3.putEnumerated(sTID("warpRotate"), cTID('Ornt'), cTID('Hrzn'));
var desc4 = new ActionDescriptor();
desc4.putUnitDouble(cTID('Top '), cTID('#Pxl'), -285);
desc4.putUnitDouble(cTID('Left'), cTID('#Pxl'), 1);
desc4.putUnitDouble(cTID('Btom'), cTID('#Pxl'), 883);
desc4.putUnitDouble(cTID('Rght'), cTID('#Pxl'), 599);
desc3.putObject(sTID("bounds"), cTID('Rctn'), desc4);
desc3.putInteger(sTID("uOrder"), 4);
desc3.putInteger(sTID("vOrder"), 4);
var desc5 = new ActionDescriptor();
var list1 = new ActionList();
var desc6 = new ActionDescriptor();
desc6.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 1);
desc6.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), -285);
list1.putObject(sTID("rationalPoint"), desc6);
var desc7 = new ActionDescriptor();
desc7.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 200.333343505859);
desc7.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), -285);
list1.putObject(sTID("rationalPoint"), desc7);
var desc8 = new ActionDescriptor();
desc8.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 399.666687011719);
desc8.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), -285);
list1.putObject(sTID("rationalPoint"), desc8);
var desc9 = new ActionDescriptor();
desc9.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 599);
desc9.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), -285);
list1.putObject(sTID("rationalPoint"), desc9);
var desc10 = new ActionDescriptor();
desc10.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 1.00000011920929);
desc10.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), 104.333343505859);
list1.putObject(sTID("rationalPoint"), desc10);
var desc11 = new ActionDescriptor();
desc11.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 187.129730224609);
desc11.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), 81.6374359130859);
list1.putObject(sTID("rationalPoint"), desc11);
var desc12 = new ActionDescriptor();
desc12.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 390.082641601563);
desc12.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), 87.8594360351563);
list1.putObject(sTID("rationalPoint"), desc12);
var desc13 = new ActionDescriptor();
desc13.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 599.000061035156);
desc13.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), 104.333343505859);
list1.putObject(sTID("rationalPoint"), desc13);
var desc14 = new ActionDescriptor();
desc14.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 1);
desc14.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), 493.666931152344);
list1.putObject(sTID("rationalPoint"), desc14);
var desc15 = new ActionDescriptor();
desc15.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), -327.811401367188);
desc15.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), -414.169067382813);
list1.putObject(sTID("rationalPoint"), desc15);
var desc16 = new ActionDescriptor();
desc16.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 16.3106994628906);
desc16.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), -165.289978027344);
list1.putObject(sTID("rationalPoint"), desc16);
var desc17 = new ActionDescriptor();
desc17.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 599.000122070313);
desc17.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), 493.666931152344);
list1.putObject(sTID("rationalPoint"), desc17);
var desc18 = new ActionDescriptor();
desc18.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 1);
desc18.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), 883);
list1.putObject(sTID("rationalPoint"), desc18);
var desc19 = new ActionDescriptor();
desc19.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 194.751022338867);
desc19.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), 873.404479980469);
list1.putObject(sTID("rationalPoint"), desc19);
var desc20 = new ActionDescriptor();
desc20.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 395.61474609375);
desc20.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), 876.035034179688);
list1.putObject(sTID("rationalPoint"), desc20);
var desc21 = new ActionDescriptor();
desc21.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), 599);
desc21.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), 883);
list1.putObject(sTID("rationalPoint"), desc21);
desc5.putList(sTID("meshPoints"), list1);
desc3.putObject(sTID("customEnvelopeWarp"), sTID("customEnvelopeWarp"), desc5);
desc1.putObject(cTID('warp'), cTID('warp'), desc3);
executeAction(cTID('Trnf'), desc1, dialogMode);
};
Scriptlistener code (different example) looks like this:
var id271 = charIDToTypeID( "Trnf" );
var desc54 = new ActionDescriptor();
var id272 = charIDToTypeID( "null" );
var ref13 = new ActionReference();
var id273 = charIDToTypeID( "Lyr " );
var id274 = charIDToTypeID( "Ordn" );
var id275 = charIDToTypeID( "Trgt" );
ref13.putEnumerated( id273, id274, id275 );
desc54.putReference( id272, ref13 );
var id276 = charIDToTypeID( "FTcs" );
var id277 = charIDToTypeID( "QCSt" );
var id278 = charIDToTypeID( "Qcsa" );
desc54.putEnumerated( id276, id277, id278 );
var id279 = charIDToTypeID( "Ofst" );
var desc55 = new ActionDescriptor();
var id280 = charIDToTypeID( "Hrzn" );
var id281 = charIDToTypeID( "#Rlt" );
desc55.putUnitDouble( id280, id281, -0.000000 );
var id282 = charIDToTypeID( "Vrtc" );
var id283 = charIDToTypeID( "#Rlt" );
desc55.putUnitDouble( id282, id283, 0.000000 );
var id284 = charIDToTypeID( "Ofst" );
desc54.putObject( id279, id284, desc55 );
var id285 = stringIDToTypeID( "warp" );
var desc56 = new ActionDescriptor();
var id286 = stringIDToTypeID( "warpStyle" );
var id287 = stringIDToTypeID( "warpStyle" );
var id288 = stringIDToTypeID( "warpCustom" );
desc56.putEnumerated( id286, id287, id288 );
var id289 = stringIDToTypeID( "warpValue" );
desc56.putDouble( id289, 0.000000 );
var id290 = stringIDToTypeID( "warpPerspective" );
desc56.putDouble( id290, 0.000000 );
var id291 = stringIDToTypeID( "warpPerspectiveOther" );
desc56.putDouble( id291, 0.000000 );
var id292 = stringIDToTypeID( "warpRotate" );
var id293 = charIDToTypeID( "Ornt" );
var id294 = charIDToTypeID( "Hrzn" );
desc56.putEnumerated( id292, id293, id294 );
var id295 = stringIDToTypeID( "bounds" );
var desc57 = new ActionDescriptor();
var id296 = charIDToTypeID( "Top " );
var id297 = charIDToTypeID( "#Pxl" );
desc57.putUnitDouble( id296, id297, 0.000000 );
var id298 = charIDToTypeID( "Left" );
var id299 = charIDToTypeID( "#Pxl" );
desc57.putUnitDouble( id298, id299, -2.000000 );
var id300 = charIDToTypeID( "Btom" );
var id301 = charIDToTypeID( "#Pxl" );
desc57.putUnitDouble( id300, id301, 540.000000 );
var id302 = charIDToTypeID( "Rght" );
var id303 = charIDToTypeID( "#Pxl" );
desc57.putUnitDouble( id302, id303, 565.000000 );
var id304 = charIDToTypeID( "Rctn" );
desc56.putObject( id295, id304, desc57 );
var id305 = stringIDToTypeID( "uOrder" );
desc56.putInteger( id305, 4 );
var id306 = stringIDToTypeID( "vOrder" );
desc56.putInteger( id306, 4 );
var id307 = stringIDToTypeID( "customEnvelopeWarp" );
var desc58 = new ActionDescriptor();
var id308 = stringIDToTypeID( "meshPoints" );
var list2 = new ActionList();
var desc59 = new ActionDescriptor();
var id309 = charIDToTypeID( "Hrzn" );
var id310 = charIDToTypeID( "#Pxl" );
desc59.putUnitDouble( id309, id310, -2.000000 );
var id311 = charIDToTypeID( "Vrtc" );
var id312 = charIDToTypeID( "#Pxl" );
desc59.putUnitDouble( id311, id312, 0.000000 );
var id313 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id313, desc59 );
var desc60 = new ActionDescriptor();
var id314 = charIDToTypeID( "Hrzn" );
var id315 = charIDToTypeID( "#Pxl" );
desc60.putUnitDouble( id314, id315, 190.000000 );
var id316 = charIDToTypeID( "Vrtc" );
var id317 = charIDToTypeID( "#Pxl" );
desc60.putUnitDouble( id316, id317, 67.000000 );
var id318 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id318, desc60 );
var desc61 = new ActionDescriptor();
var id319 = charIDToTypeID( "Hrzn" );
var id320 = charIDToTypeID( "#Pxl" );
desc61.putUnitDouble( id319, id320, 377.000000 );
var id321 = charIDToTypeID( "Vrtc" );
var id322 = charIDToTypeID( "#Pxl" );
desc61.putUnitDouble( id321, id322, 63.000000 );
var id323 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id323, desc61 );
var desc62 = new ActionDescriptor();
var id324 = charIDToTypeID( "Hrzn" );
var id325 = charIDToTypeID( "#Pxl" );
desc62.putUnitDouble( id324, id325, 565.000000 );
var id326 = charIDToTypeID( "Vrtc" );
var id327 = charIDToTypeID( "#Pxl" );
desc62.putUnitDouble( id326, id327, 0.000000 );
var id328 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id328, desc62 );
var desc63 = new ActionDescriptor();
var id329 = charIDToTypeID( "Hrzn" );
var id330 = charIDToTypeID( "#Pxl" );
desc63.putUnitDouble( id329, id330, 0.000000 );
var id331 = charIDToTypeID( "Vrtc" );
var id332 = charIDToTypeID( "#Pxl" );
desc63.putUnitDouble( id331, id332, 93.000000 );
var id333 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id333, desc63 );
var desc64 = new ActionDescriptor();
var id334 = charIDToTypeID( "Hrzn" );
var id335 = charIDToTypeID( "#Pxl" );
desc64.putUnitDouble( id334, id335, 187.000000 );
var id336 = charIDToTypeID( "Vrtc" );
var id337 = charIDToTypeID( "#Pxl" );
desc64.putUnitDouble( id336, id337, 180.000000 );
var id338 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id338, desc64 );
var desc65 = new ActionDescriptor();
var id339 = charIDToTypeID( "Hrzn" );
var id340 = charIDToTypeID( "#Pxl" );
desc65.putUnitDouble( id339, id340, 376.000000 );
var id341 = charIDToTypeID( "Vrtc" );
var id342 = charIDToTypeID( "#Pxl" );
desc65.putUnitDouble( id341, id342, 180.000000 );
var id343 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id343, desc65 );
var desc66 = new ActionDescriptor();
var id344 = charIDToTypeID( "Hrzn" );
var id345 = charIDToTypeID( "#Pxl" );
desc66.putUnitDouble( id344, id345, 569.000000 );
var id346 = charIDToTypeID( "Vrtc" );
var id347 = charIDToTypeID( "#Pxl" );
desc66.putUnitDouble( id346, id347, 100.000000 );
var id348 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id348, desc66 );
var desc67 = new ActionDescriptor();
var id349 = charIDToTypeID( "Hrzn" );
var id350 = charIDToTypeID( "#Pxl" );
desc67.putUnitDouble( id349, id350, -2.000000 );
var id351 = charIDToTypeID( "Vrtc" );
var id352 = charIDToTypeID( "#Pxl" );
desc67.putUnitDouble( id351, id352, 306.000000 );
var id353 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id353, desc67 );
var desc68 = new ActionDescriptor();
var id354 = charIDToTypeID( "Hrzn" );
var id355 = charIDToTypeID( "#Pxl" );
desc68.putUnitDouble( id354, id355, 187.000000 );
var id356 = charIDToTypeID( "Vrtc" );
var id357 = charIDToTypeID( "#Pxl" );
desc68.putUnitDouble( id356, id357, 360.000000 );
var id358 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id358, desc68 );
var desc69 = new ActionDescriptor();
var id359 = charIDToTypeID( "Hrzn" );
var id360 = charIDToTypeID( "#Pxl" );
desc69.putUnitDouble( id359, id360, 376.000000 );
var id361 = charIDToTypeID( "Vrtc" );
var id362 = charIDToTypeID( "#Pxl" );
desc69.putUnitDouble( id361, id362, 360.000000 );
var id363 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id363, desc69 );
var desc70 = new ActionDescriptor();
var id364 = charIDToTypeID( "Hrzn" );
var id365 = charIDToTypeID( "#Pxl" );
desc70.putUnitDouble( id364, id365, 567.000000 );
var id366 = charIDToTypeID( "Vrtc" );
var id367 = charIDToTypeID( "#Pxl" );
desc70.putUnitDouble( id366, id367, 298.000000 );
var id368 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id368, desc70 );
var desc71 = new ActionDescriptor();
var id369 = charIDToTypeID( "Hrzn" );
var id370 = charIDToTypeID( "#Pxl" );
desc71.putUnitDouble( id369, id370, 0.000000 );
var id371 = charIDToTypeID( "Vrtc" );
var id372 = charIDToTypeID( "#Pxl" );
desc71.putUnitDouble( id371, id372, 490.000000 );
var id373 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id373, desc71 );
var desc72 = new ActionDescriptor();
var id374 = charIDToTypeID( "Hrzn" );
var id375 = charIDToTypeID( "#Pxl" );
desc72.putUnitDouble( id374, id375, 187.000000 );
var id376 = charIDToTypeID( "Vrtc" );
var id377 = charIDToTypeID( "#Pxl" );
desc72.putUnitDouble( id376, id377, 540.000000 );
var id378 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id378, desc72 );
var desc73 = new ActionDescriptor();
var id379 = charIDToTypeID( "Hrzn" );
var id380 = charIDToTypeID( "#Pxl" );
desc73.putUnitDouble( id379, id380, 376.000000 );
var id381 = charIDToTypeID( "Vrtc" );
var id382 = charIDToTypeID( "#Pxl" );
desc73.putUnitDouble( id381, id382, 540.000000 );
var id383 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id383, desc73 );
var desc74 = new ActionDescriptor();
var id384 = charIDToTypeID( "Hrzn" );
var id385 = charIDToTypeID( "#Pxl" );
desc74.putUnitDouble( id384, id385, 563.000000 );
var id386 = charIDToTypeID( "Vrtc" );
var id387 = charIDToTypeID( "#Pxl" );
desc74.putUnitDouble( id386, id387, 494.000000 );
var id388 = stringIDToTypeID( "rationalPoint" );
list2.putObject( id388, desc74 );
desc58.putList( id308, list2 );
var id389 = stringIDToTypeID( "customEnvelopeWarp" );
desc56.putObject( id307, id389, desc58 );
var id390 = stringIDToTypeID( "warp" );
desc54.putObject( id285, id390, desc56 );
executeAction( id271, desc54, DialogModes.NO );