选中多个图层
方法一:
select_layer("图层 2");
select_layer("图层 5", true);
function select_layer(nm, add)
{
try {
var r = new ActionReference();
r.putName(stringIDToTypeID("layer"), nm);
var d = new ActionDescriptor();
d.putReference(stringIDToTypeID("null"), r);
if (add == true) d.putEnumerated(stringIDToTypeID("selectionModifier"), stringIDToTypeID("selectionModifierType"), stringIDToTypeID("addToSelection"));
executeAction(stringIDToTypeID("select"), d, DialogModes.NO);
}
catch (e) { alert(e); throw(e); }
}
方法二:
function doesIdExists( id ){// function to check if the id exists
var res = true;
var ref = new ActionReference();
ref.putIdentifier(charIDToTypeID('Lyr '), id);
try{var desc = executeActionGet(ref)}catch(err){res = false};
return res;
}
function multiSel

本文介绍两种在图像编辑软件中批量选中指定编号图层的方法。方法一使用逐个添加的方式实现图层的选择;方法二通过定义函数,传入图层编号数组,一次性完成多个图层的选择操作。
最低0.47元/天 解锁文章
1446





