Can you fix this Adobe Photoshop Script? : const exportFolder = Folder.desktop.fullName…
- User
Can you fix this Adobe Photoshop Script? : const exportFolder = Folder.desktop.fullName + "\Photoshop Export";
// Create the export folder if it doesn't exist if (!Folder(exportFolder).exists) { Folder(exportFolder).create(); }
function exportLayersAsJPG() { const doc = app.activeDocument; const docName = doc.name.replace('.psd', '');
for (let i = 0; i < doc.layers.length; i++) { const layer = doc.layers[i]; if (!layer.visible) continue;
const fileName = `${docName} - ${layer.name}.jpg`; const filePath = `${exportFolder}\\${fileName}`; const jpegOptions = new JPEGSaveOptions(); jpegOptions.quality = 11; doc.activeLayer = layer; doc.saveAs(File(filePath), jpegOptions, true, Extension.LOWERCASE);} }
exportLayersAsJPG();
- Assistant
Your script for exporting layers as JPG in Adobe Photoshop seems quite close, but there are a few issues that need to be addressed to make it work correctly. Here is a revised version:
- User
Error 25 on Line 12
- Assistant
The error you're experiencing usually indicates a syntax or runtime issue, and in this context, it's related to the way the document is being manipulated. Let's address this with a corrected approach that handles layers in Photoshop more precisely.
- User
Same error
- Assistant
- User
Same error, are you changing anything?
- Assistant
- User
Error 23 on Line 13, Please double check before writing, also check web
- Assistant