This content has been marked as final.
Show 3 replies
-
1. Re: Trouble with naming files when saving
Stephen_A_Marsh Aug 28, 2017 11:06 PM (in response to parseeker)1 person found this helpfulNot an exact attempt to directly answer your question… however a script to save an incrementally named JPEG copy of the source image can be found here:
How to incrementally save images using a hotkey
Filename.psd
Filename_001.jpg
Filename_002.jpg
etc…
It should be “easy enough” to hack the script into saving a different file format, such as PSD, TIFF etc.
-
2. Re: Trouble with naming files when saving
Stephen_A_Marsh Aug 28, 2017 11:27 PM (in response to Stephen_A_Marsh)1 person found this helpfulHere is a copy of the incremental JPEG save script that I just hacked into saving out a PSD file:
// https://forums.adobe.com/message/4453915#4453915 #target photoshop main(); function main(){ if(!documents.length) return; var Name = app.activeDocument.name.replace(/\.[^\.]+$/, ''); try{ var savePath = activeDocument.path; }catch(e){ alert("You must save this document first!"); } var fileList= savePath.getFiles(Name +"*.psd").sort().reverse(); var Suffix = 0; if(fileList.length){ Suffix = Number(fileList[0].name.replace(/\.[^\.]+$/, '').match(/\d+$/)); } Suffix= zeroPad(Suffix + 1, 3); var saveFile = File(savePath + "/" + Name + "_" + Suffix + ".psd"); SavePSD(saveFile); } function SavePSD(saveFile){ // http://jongware.mit.edu/pscs5js_html/psjscs5/pc_PhotoshopSaveOptions.html psdSaveOptions = new PhotoshopSaveOptions(); psdSaveOptions.embedColorProfile = true; psdSaveOptions.alphaChannels = true; psdSaveOptions.layers = true; psdSaveOptions.annotations = true; psdSaveOptions.spotColors = true; activeDocument.saveAs(saveFile, psdSaveOptions, true, Extension.LOWERCASE); }; function zeroPad(n, s) { n = n.toString(); while (n.length < s) n = '0' + n; return n; };
-
3. Re: Trouble with naming files when saving
Stephen_A_Marsh Aug 28, 2017 11:28 PM (in response to Stephen_A_Marsh)Here is a copy of the incremental JPEG save script that I just hacked into saving out a TIFF file:
// https://forums.adobe.com/message/4453915#4453915 #target photoshop main(); function main(){ if(!documents.length) return; var Name = app.activeDocument.name.replace(/\.[^\.]+$/, ''); try{ var savePath = activeDocument.path; }catch(e){ alert("You must save this document first!"); } var fileList= savePath.getFiles(Name +"*.tif").sort().reverse(); var Suffix = 0; if(fileList.length){ Suffix = Number(fileList[0].name.replace(/\.[^\.]+$/, '').match(/\d+$/)); } Suffix= zeroPad(Suffix + 1, 3); var saveFile = File(savePath + "/" + Name + "_" + Suffix + ".tif"); SaveTIFF(saveFile); } function SaveTIFF(saveFile){ // http://jongware.mit.edu/pscs5js_html/psjscs5/pc_TiffSaveOptions.html // http://jongware.mit.edu/pscs5js_html/psjscs5/pe_TIFFEncoding.html // TIFFEncoding.NONE // TIFFEncoding.JPEG // TIFFEncoding.TIFFLZW // TIFFEncoding.TIFFZIP tiffSaveOptions = new TiffSaveOptions(); tiffSaveOptions.embedColorProfile = true; tiffSaveOptions.byteOrder = ByteOrder.IBM; tiffSaveOptions.transparency = true; tiffSaveOptions.layers = true; tiffSaveOptions.layerCompression = LayerCompression.ZIP; tiffSaveOptions.interleaveChannels= true; tiffSaveOptions.alphaChannels = true; tiffSaveOptions.spotColors = true; tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW; activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE); }; function zeroPad(n, s) { n = n.toString(); while (n.length < s) n = '0' + n; return n; };