Hello everyone, I have this script of saving a TIF that i want to improve. currently it tries to use activeDocument.path, if it doesn't have one it asks to choose the folder via a dialog. I have 3 documents. document 2 and 3 doesn't have a path because they are new documents (Ctrl+N) I want if the active document doesn't have a path to loop through all opened documents (start from first document) and then if it finds a path, it exits the loop and uses this path to save all documents that don't have a path. If none of the documents have a path, it asks to choose the folder where all the documents will be saved at, via a dialog. this is my original script: #target photoshop main(); function main(){ if(!documents.length) return; var Name = app.activeDocument.name.replace(/\.[^\.]+$/, ''); try{ var savePath = activeDocument.path; } catch(e) { savePath = Folder.selectDialog("select folder"); } var fileList= savePath.getFiles(Name +"*.tif").sort().reverse(); var saveName = File(savePath + "/" + Name) SaveTIFF(saveName); } ////////////////////////////////////////////////////////////////////////////////////////////////// function zeroPad(n, s) { n = n.toString(); while (n.length < s) n = '0' + n; return n; }; function SaveTIFF(saveFile){ tiffSaveOptions = new TiffSaveOptions(); tiffSaveOptions.embedColorProfile = true; tiffSaveOptions.alphaChannels = true; tiffSaveOptions.layers = true; tiffSaveOptions.imageCompression = TIFFEncoding.NONE; //tiffSaveOptions.jpegQuality=10; activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE); } Thank you!
... View more