Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

export all files using saveAsWeb & device

$
0
0

Hi Forum..

 

New to scripting. please help.

 

 

I have this little bit, which is converting only the active document (single file) as ExportOptionsSaveForWeb().

 

I wish to export all the activeDocument using ExportOptionsSaveForWeb(). Here only one document is done and all the others is closed without converting...

 

function main(){

if(documents.length!=0)

var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');

var saveFile = File(Folder("/Users/wleastudio/Desktop/untitled folder")  + "/" +  Name + ".jpg");

if(saveFile.exists){

   if(!confirm("Overwrite existing document?")) return;

    saveFile.remove();

    }

SaveForWeb(saveFile,60); //change to 60 for 60%

}

main();

function SaveForWeb(saveFile,jpegQuality) {

var sfwOptions = new ExportOptionsSaveForWeb();

   sfwOptions.format = SaveDocumentType.JPEG;

   sfwOptions.includeProfile = false;

      sfwOptions.convertProfile = false;

   sfwOptions.interlaced = 0;

   sfwOptions.optimized = true;

   sfwOptions.quality = 60;

   sfwOptions.compression = 60; //0-100

activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);

}

 

 

while(app.documents.length > 0)

     {

     app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

     }


Viewing all articles
Browse latest Browse all 12244

Trending Articles