@Stephen Marsh - JPG Script woks, but noth PNG
This is the Error:
- <no further information available>
Line: 27
-> doc.exportDocument(saveFilePNG, ExportType.SAVEFORWEB, exportOptions);
(Translated from German)
And this is the line Nr. 27 on my code:
doc.exportDocument(saveFilePNG, ExportType.SAVEFORWEB, exportOptions);
@hamid5C9F
Try this revised version:
/* Save for web PNG - Transpose filename around underscore: 'fileName_123456.psd' as '123456_fileName.png' */
#target photoshop
// File naming
var doc = app.activeDocument;
var docName = doc.name.replace(/\.[^\.]+$/, '');
var docNameOutput = docName.replace(/(.+)(_)(\d+)/, '$3$2$1');
// Output directory
var outputFolder = new Folder(decodeURI('~/Desktop/PNG'));
if (outputFolder.exists === false) outputFolder.create();
// PNG S4W Options
var pngOptions = new ExportOptionsSaveForWeb();
pngOptions.PNG8 = false;
pngOptions.transparency = true;
pngOptions.interlaced = false;
pngOptions.quality = 100;
pngOptions.includeProfile = true;
pngOptions.format = SaveDocumentType.PNG;
// File path & naming
activeDocument.exportDocument(File(outputFolder + '/' + docNameOutput + '.png'), ExportType.SAVEFORWEB, pngOptions);
// Optional end of script alert, comment out or remove as required
app.beep();