@Andrew37041986a7pl
Try this script. You might need to change the folder name in the script as I'm not sure if you are using _jpg or _jpeg or something else...
/*
All Layer Comps to JPEG.jsx
v1.0, 30th April 2024 - Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-discussions/droplets-and-export-layer-comps-to-files/td-p/14585398
Based on:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/a-script-that-would-pack-layercomps-into-rgba-channels-and-saving-in-chosen-file-format/m-p/13906491
Info: Suitable for batch processing when recorded into an action.
*/
#target photoshop
if (documents.length > 0) {
if (activeDocument.layerComps.length) {
app.togglePalettes();
var restoreDialogMode = app.displayDialogs;
app.displayDialogs = DialogModes.NO;
try {
//var theSavePath = Folder.selectDialog("Select the output folder:");
var theSavePath = Folder('~/Desktop/_jpg');
if (!theSavePath.exists) {
theSavePath.create();
}
} catch (e) {
var theSavePath = Folder('~/Desktop/');
}
deleteDocumentAncestorsMetadata();
removeCRSmeta();
removeXMP();
for (i = 0; i < activeDocument.layerComps.length; i++) {
activeDocument.layerComps[i].apply();
var compName = activeDocument.layerComps[i].name;
saveCompToJPG();
}
app.togglePalettes();
app.displayDialogs = restoreDialogMode;
activeDocument.close(SaveOptions.DONOTSAVECHANGES);
} else {
alert("The document must contain layer comps!");
}
} else {
alert("You must have a document open!");
}
function saveCompToJPG() {
try {
var filePath = new File(theSavePath + "/" + compName + ".jpg");
var jpgOptns = new JPEGSaveOptions();
jpgOptns.formatOptions = FormatOptions.STANDARDBASELINE;
jpgOptns.embedColorProfile = true;
jpgOptns.matte = MatteType.NONE;
jpgOptns.quality = 12;
activeDocument.saveAs(filePath, jpgOptns, true, Extension.LOWERCASE);
} catch (e) {
alert("Error!" + "\r" + e + ' ' + e.line);
}
}
function removeXMP() {
//https://community.adobe.com/t5/photoshop/script-to-remove-all-meta-data-from-the-photo/td-p/10400906
if (!documents.length) return;
if (ExternalObject.AdobeXMPScript === undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);
XMPUtils.removeProperties(xmp, "", "", XMPConst.REMOVE_ALL_PROPERTIES);
app.activeDocument.xmpMetadata.rawData = xmp.serialize();
}
function removeCRSmeta() {
//community.adobe.com/t5/photoshop/remove-crs-metadata/td-p/10306935
if (!documents.length) return;
if (ExternalObject.AdobeXMPScript === undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var xmp = new XMPMeta(app.activeDocument.xmpMetadata.rawData);
XMPUtils.removeProperties(xmp, XMPConst.NS_CAMERA_RAW, "", XMPConst.REMOVE_ALL_PROPERTIES);
app.activeDocument.xmpMetadata.rawData = xmp.serialize();
}
function deleteDocumentAncestorsMetadata() {
whatApp = String(app.name); //String version of the app name
if (whatApp.search("Photoshop") > 0) { //Check for photoshop specifically, or this will cause errors
if (ExternalObject.AdobeXMPScript === undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);
// Begone foul Document Ancestors!
xmp.deleteProperty(XMPConst.NS_PHOTOSHOP, "DocumentAncestors");
app.activeDocument.xmpMetadata.rawData = xmp.serialize();
}
}
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html