脚本代码如下
//win7/photoshop CC,cs6测试通过
#target photoshop
app.bringToFront();
if (documents.length == 0) {
alert("没有可处理的文档");
}
else {
var visibility = false;
var docRef = activeDocument;
var layers = docRef.layers;
var originalStem = app.activeDocument.activeLayer;
var stemsAmount = prompt("输入您的图层名称,\n如默认当前图层名称请点击确定。",originalStem.name,"当前图层名称: "+originalStem.name);
if (layers.length == 1 && docRef.activeLayer.isBackgroundLayer == 1) {
alert("The Background layer can not be hidden when it is the only layer in a document.");
}
else {
for (var i = 0; i < layers.length; i++) {
layers[i].name = [stemsAmount]+" "+i;
}
}
}
文末有我已经写好的脚本直接下载然后选择脚本-浏览导入即可。也可以放在PS脚本目录下,每台电脑不一样,比如我的就是D:\Program Files (x86)\Adobe\Photoshop CS6\Presets\Scripts