1 Reply Latest reply on Jun 27, 2010 11:53 AM by Michael L Hale

    CS4: get file name after saving for web

    cmeira Level 1

      Hello,

      I am saving a file via "save for web" with a specific file name in a specific folder maybe with a specific resolution (width x height) entered directy within this dialog window.

      Is it possible to get this path and the optionally changed resolution via Adobe script (after saving the file; or starting the script just before "save for web")?

       

      Thanks a lot!

      Carlos

        • 1. Re: CS4: get file name after saving for web
          Michael L Hale Level 5

          I don't see anyway to get the user's options from the SaveForWeb dialog. The descriptors for both charIDToTypeID( "Expr" ) and charIDToTypeID( "Mn  " ) are empty.

           

          But you can use the DOM to sfw. Below is a function to save jpg using sfw.

          function SaveForWeb(saveFile,jpegQuality) {
          var sfwOptions = new ExportOptionsSaveForWeb();
             sfwOptions.format = SaveDocumentType.JPEG;
             sfwOptions.includeProfile = false;
             sfwOptions.interlaced = false;
             sfwOptions.optimized = true;
             sfwOptions.quality = jpegQuality; //0-100
          activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);
          }
          

          Look up ExportOptionsSaveForWeb in the scripting guide for other formats.

           

          You would have to do the resize as an extra step when saving using the DOM.