Change this script to save jpegs instead of tiff....
hi, im hoping can me this, found wonderfull script save out quick incremental saves of active document (got this thread ) need save out jpegs instead of tiffs.
#target photoshop app.bringtofront(); main(); function main(){ if(!documents.length) return; //amend suit var folderpath = folder("/c/users/kerro perro/desktop/dropbox/daily drawing practice/wips"); if(!folderpath.exists) { alert("output folder not exist!"); return; } //this should first part of filename //i.e. if file name = picture0001.tif needs picture //n.b. must same case! var filename = "workinprogress"; var filetype = "tif"; var filelist = new array(); var newnumber=0; var savefile=''; filelist = folderpath.getfiles((filename + "*." + filetype)); filelist.sort().reverse(); if(filelist.length == 0){ savefile=file(folderpath + "/" + filename + "0001." +filetype); savetiff(savefile); }else{ newnumber = number(filelist[0].tostring().replace(/\....$/,'').match(/\d+$/)) +1; savefile=file(folderpath + "/" + filename + zeropad(newnumber, 4) + "." +filetype); savetiff(savefile); } }; 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.tifflzw; activedocument.saveas(savefile, tiffsaveoptions, true, extension.lowercase); };
now severely limited coding skill cut , pasted different code keeps saving on same file (i.e. workinprogress0001.jpg gets saved on , on instead of creating new iteration each time workinprogress0002.jpg, workinprogress0003.jpg etc.) , can't fathom variable being affected changing extension... thoughts?
#target photoshop app.bringtofront(); main(); function main(){ if(!documents.length) return; //amend suit var folderpath = folder("/c/users/kerro perro/desktop/dropbox/daily drawing practice/wips"); if(!folderpath.exists) { alert("output folder not exist!"); return; } //this should first part of filename //i.e. if file name = picture0001.tif needs picture //n.b. must same case! var filename = "workinprogress"; var filetype = "jpeg"; var filelist = new array(); var newnumber=0; var savefile=''; filelist = folderpath.getfiles((filename + "*." + filetype)); filelist.sort().reverse(); if(filelist.length == 0){ savefile=file(folderpath + "/" + filename + "0001." +filetype); savejpeg(savefile); }else{ newnumber = number(filelist[0].tostring().replace(/\....$/,'').match(/\d+$/)) +1; savefile=file(folderpath + "/" + filename + zeropad(newnumber, 4) + "." +filetype); savejpeg(savefile); } }; function zeropad(n, s) { n = n.tostring(); while (n.length < s) n = '0' + n; return n; }; function savejpeg(savefile){ var saveoptions = new jpegsaveoptions( ); saveoptions.embedcolorprofile = true; saveoptions.formatoptions = formatoptions.standardbaseline; saveoptions.matte = mattetype.none; saveoptions.quality = 10; activedocument.saveas(savefile, saveoptions, true, extension.lowercase); };
More discussions in Photoshop Scripting
adobe
Comments
Post a Comment