Skip to main content
June 27, 2010
Question

CS4: get file name after saving for web

  • June 27, 2010
  • 1 reply
  • 402 views

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

This topic has been closed for replies.

1 reply

Inspiring
June 27, 2010

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.