Add some lines for the selected layers
Greetings to all
I collected some lines and came up with this code, which is to create a Smart Object for the layer, and then open the Smart Object and save the file based on the dimensions of the document
But I just want a simple modification, which is to perform this procedure on the selected layers (meaning the layers you selected) and the procedure is performed on them
is this possible??
This is the code
var currentDoc = app.activeDocument;
if (app.activeDocument.activeLayer.kind == "LayerKind.SMARTOBJECT") {
runMenuItem(stringIDToTypeID('placedLayerEditContents'))
Save ();
} else {
app.runMenuItem(stringIDToTypeID('newPlacedLayer'));
runMenuItem(stringIDToTypeID('placedLayerEditContents'));
Save ();
}
function Save () {
var doc = app.activeDocument;
var currentDoc = app.activeDocument;
var docpath = doc.path;
var activeLayer = doc.activeLayer;
var Sizze= Math.round(currentDoc.width)+ " " + Math.round(currentDoc.height)
var saveFile = File(docpath + "/" + Sizze + ".jpg");
while(saveFile.exists){
Sizze = ' '+ Sizze ;
saveFile = File(docpath + "/" +Sizze + ".jpg")
};
saveJPG(saveFile, 10);
function saveJPG(saveFile, jpegQuality) {
var jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality;
activeDocument.saveAs(saveFile, jpgSaveOptions, true, Extension.LOWERCASE);
};
app.activeDocument.close();
}I just want to add some lines to perform the action on the selected layers, not just one layer
