5 Replies Latest reply on Jun 30, 2013 2:16 AM by shilpa25

    export all files using saveAsWeb & device

    shilpa25

      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);

           }