公司里有人有个需求说可以再photoshop里面显示特定的layer,用特定的名字,比如一个layer叫张三,那么把layer为张三的都显示出来,其他的隐藏掉,以前有个人用python写的东西,后来查了一下才知道photoshop内部自带script功能,所以用了半天时间看了document,在photoshop javascript API里面,然后写出来了这个
var docRef = app.activeDocument;
var layers = docRef.layers;
//var myLayer = layers["组5"]; //this defines the layer that you want to get the selection from
//var myLayer = app.activeDocument.layers["组5"];
//var exLayer= app.activeDocument.layers['导出组'];
var layerSum=app.activeDocument.layerSets;
alert("开始执行");
//alert(myLayer.layers);
docRef.selection = null;//这句是让你没有选中任何图层
var item={};
var a="";
var theLayer={};
for (var i=0;i<layerSum.length;i++){
layerSum[i].visible=false;
theName=layerSum[i].name;
theLayer=app.activeDocument.layers[theName];
for (var