我从https://forums.adobe.com/thread/1536677获得了一些代码,这可以获得图层的界限
c = getchar()
s[i] != c // it means that my inputted value can not be equal to s[i].
我想知道如何编写或使用ScriptListener.8li来生成这个,我可以使用ScriptListener.8li进行一些转换等。但我不知道如何获取信息。非常感谢!
function getLBounds(){
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr ") , charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
desc1 = executeActionGet(ref);
desc1 = desc1.getObjectValue(stringIDToTypeID('bounds'));
desc1Top = desc1.getUnitDoubleValue(stringIDToTypeID('top'));
desc1Bottom = desc1.getUnitDoubleValue(stringIDToTypeID('bottom'));
desc1Left = desc1.getUnitDoubleValue(stringIDToTypeID('left'));
desc1Right = desc1.getUnitDoubleValue(stringIDToTypeID('right'));
rObj = {top:desc1Top, left:desc1Left, bottom:desc1Bottom, right:desc1Right};
return rObj;
}
PS:最后一个代码是从ScriptListener.8li生成的,我想知道如何生成第一个函数getLBounds。
答案 0 :(得分:0)
有四个字母的脚本侦听器代码列表。例如,“Trnf”就是变换。谷歌是你的朋友。
但有时候很容易查看每个命令并依次查看每个参数。我可以看到你的一些代码不成比例地旋转和缩小图像层,增加了一些偏斜和一点点偏移。
// =======================================================
var idTrnf = charIDToTypeID( "Trnf" );
var desc2 = new ActionDescriptor();
var idFTcs = charIDToTypeID( "FTcs" );
var idQCSt = charIDToTypeID( "QCSt" );
var idQcsa = charIDToTypeID( "Qcsa" );
desc2.putEnumerated( idFTcs, idQCSt, idQcsa );
var idOfst = charIDToTypeID( "Ofst" );
var desc3 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc3.putUnitDouble( idHrzn, idPxl, 0.000000 ); // X transform offest amount in pixels
var idVrtc = charIDToTypeID( "Vrtc" );
var idPxl = charIDToTypeID( "#Pxl" );
desc3.putUnitDouble( idVrtc, idPxl, 0.013677 ); // Y transform offest amount in pixels
var idOfst = charIDToTypeID( "Ofst" );
desc2.putObject( idOfst, idOfst, desc3 );
var idWdth = charIDToTypeID( "Wdth" );
var idPrc = charIDToTypeID( "#Prc" );
desc2.putUnitDouble( idWdth, idPrc, 86.486860 ); // Width amount %
var idHght = charIDToTypeID( "Hght" );
var idPrc = charIDToTypeID( "#Prc" );
desc2.putUnitDouble( idHght, idPrc, -88.215838 ); // Height amount %
var idSkew = charIDToTypeID( "Skew" );
var desc4 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idAng = charIDToTypeID( "#Ang" );
desc4.putUnitDouble( idHrzn, idAng, 0.033079 ); //skew horizontal amount
var idVrtc = charIDToTypeID( "Vrtc" );
var idAng = charIDToTypeID( "#Ang" );
desc4.putUnitDouble( idVrtc, idAng, 0.000000 ); // skew vertical amount
var idPnt = charIDToTypeID( "Pnt " );
desc2.putObject( idSkew, idPnt, desc4 );
var idAngl = charIDToTypeID( "Angl" );
var idAng = charIDToTypeID( "#Ang" );
desc2.putUnitDouble( idAngl, idAng, -170.957285 ); // rotational angle amount= 9.042715
executeAction( idTrnf, desc2, DialogModes.NO );
大多数参数的顺序与Photoshop菜单中显示的顺序相同。这是一个消除它们以确定每个人所做的事情的过程。