我认为翻译(在早期版本中)不起作用,或者现在已经过时,因为它是基于点的,而不是基于像素的。1 点 = 4.86127 像素
我倾向于使用这个函数来获得一个矩形或椭圆形的选择。我发现它比每次都定义四个限制(上、左、右、下)而不是四组 x 和 y 坐标更容易。
selectThis(10, 10, 90, 90, "rect")
// function selectThis (top, left, right, bottom, ellipse or rect [default], antialias [default] )
// ----------------------------------------------------------------------------
function selectThis(top, left, right, bottom, shape, aa)
{
srcDoc.selection.deselect()
// =======================================================
var id1 = charIDToTypeID( "setd" );
var desc1 = new ActionDescriptor();
var id2 = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var id3 = charIDToTypeID( "Chnl" );
var id4 = charIDToTypeID( "fsel" );
ref1.putProperty( id3, id4 );
desc1.putReference( id2, ref1 );
var id5 = charIDToTypeID( "T " );
var desc2 = new ActionDescriptor();
var id6 = charIDToTypeID( "Top " );
var id7 = charIDToTypeID( "#Pxl" );
desc2.putUnitDouble( id6, id7, top );
var id8 = charIDToTypeID( "Left" );
var id9 = charIDToTypeID( "#Pxl" );
desc2.putUnitDouble( id8, id9, left );
var id10 = charIDToTypeID( "Btom" );
var id11 = charIDToTypeID( "#Pxl" );
desc2.putUnitDouble( id10, id11, bottom );
var id12 = charIDToTypeID( "Rght" );
var id13 = charIDToTypeID( "#Pxl" );
desc2.putUnitDouble( id12, id13, right );
if (shape == "Elps" || shape == "oval")
{
var id14 = charIDToTypeID( "Elps" );
desc1.putObject( id5, id14, desc2 );
var id15 = charIDToTypeID( "AntA" );
if (aa == true || aa == undefined)
{
desc1.putBoolean( id15, true );
}
else
{
desc1.putBoolean( id15, false );
}
}
else
{
var id16 = charIDToTypeID( "Rctn" );
desc1.putObject( id5, id16, desc2 );
}
executeAction( id1, desc1, DialogModes.NO );
}
希望这会有所帮助。