hi everyone,
so after a few hours of browsing the forum, was able to scotch tape this script together so it allows me to save my files in incremental file numbers.
- i create an action to edit the file and then in that action, i run this script x-amount of times.
- it works as i tested it a few times.
but here are my questions that i can't figure out.
1. right now it says to a folder that i have to designated. how would i edit this code so it'll save in the same folder as the file i am editing?
2. so far it saves as a jpeg. does anyone know the syntax to use for a gif?
and if you're kind enough...let's say i have an animated gif file, i can't edit it in photoshop so i have to use imageready but how do i replicate the above in imageready since we're on the same topic.
THANKS!!! code is below:
// This script will save the active document to a folder with an incremental sufix
// Change the options below to match your needs
var saveFolder = new Folder( 'C:\\test' );
var saveExt = 'jpg';
var saveSufixStart = '_';
var saveSufixLength = 3;
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = 8;
// End of user options
//==========================================
function zeroPad ( num, digit ){
var tmp = num.toString(); while (tmp.length < digit) { tmp = "0" + tmp;} return tmp;
}
var docName = decodeURI ( activeDocument.name );
docName = docName.match( /(.*)(\.[^\.]+)/ ) ? docName = docName.match( /(.*)(\.[^\.]+)/ ) : docName = [ docName, docName, undefined ];
var saveName = docName[ 1 ]; // activeDocument name with out ext
var files = saveFolder.getFiles( saveName + '*.' + saveExt );// get an array of files matching doc name prefix
var saveNumber = files.length + 1;
//alert("New file number: " + zeroPad( saveNumber, saveSufixLength ));
var saveFile = new File( saveFolder + '/' + saveName + '_' + zeroPad( saveNumber, saveSufixLength ) + '.' + saveExt );
activeDocument.saveAs( saveFile, jpgSaveOptions ,true ,Extension.LOWERCASE);