[其他]代码库
#target photoshop
app.bringToFront();
if (documents.length == 0) {
alert("没有可处理的文档");
}else {
var visibility = false;
var docRef = activeDocument;
var layers = docRef.layers;
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 {
var outputFolder = Folder.selectDialog("请选择输出目录");
if(outputFolder!=null)
{
var jpegOptions = new JPEGSaveOptions();
jpegOptions.quality = 10;
for (var i = 0; i < layers.length; i++){
if(layers[i].name!="背景") layers[i].visible=false;
else layers[i].visible=true;
}
for (var i = layers.length-2; i >= 0; i--) {
//alert(layers[i].name + ".jpg");
layers[i].visible=true;
docRef.saveAs(new File(outputFolder + "/" + layers[i].name + ".jpg"),jpegOptions, true,Extension.LOWERCASE);
layers[i].visible=false;
}
}
}
}