Skip to main content
petera37321976
Participating Frequently
November 14, 2017
Answered

Export as... script

  • November 14, 2017
  • 1 reply
  • 6598 views

Hi,

I am currently working on a script that lets the user export an image in various resolutions (first photoshop script I'm working on...).

there is the method Document.exportDocument, but I can only use ILLUSTRATORPATHS or SAVEFORWEB as export type, which is equivalent to File > Export > Paths To Illustrator or File > Save for Web and Devices (see documentation), the latter being replaced by File > Export As... in more recent versions of photoshop CC.

So far I wasn't able to locate the javascript scripting reference for CC 2016 and later, hence my question: does anyone know either where to find the javascript reference or what the corresponding function is to do a File > Export As... in the script?

I'd prefer not to use the legacy save for web since the quality of the new export as is way better at the same filesize.

best,

peter

Correct answer r-bin

"Export As ..." is an extension. Its actions are not recorded ..
Why do not you use the simple "Save As" method, setting the parameters you want for a particular format?

1 reply

Legend
November 14, 2017

//File->Export As...

app.runMenuItem(stringIDToTypeID("exportDocumentAsDialog"));

//Layer->Export As...

app.runMenuItem(stringIDToTypeID("exportSelectionAsDialog"));

petera37321976
Participating Frequently
November 14, 2017

sorry, should have provided a few more details as it seems...

that does work, thx, good to know, but I want to run the command without the dialog actually popping up, just pass some arguments like format, quality, width, height and so on.

r-binCorrect answer
Legend
November 14, 2017

"Export As ..." is an extension. Its actions are not recorded ..
Why do not you use the simple "Save As" method, setting the parameters you want for a particular format?