How do I set the folder on a Photoshop script?

Issue

I want to write a script for Photoshop that save the files. But I don’t know how to set the destiny folder. Please, help.

app.activeDocument.save()
ExportOptionsSaveForWeb.format - SaveDocumentType.JPEG;
ExportOptionsSaveForWeb.quality = 40;
ExportOptionsSaveForWeb
app.exportDocument (exportIn, exportAs, options)

Solution

It’s probably easier not to use the export for web options:

// jpg file options
var jpgFile = new File(myfilePath);
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.formatOptions = FormatOptions.OPTIMIZEDBASELINE;
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = 40;

activeDocument.saveAs(jpgFile, jpgSaveOptions, true, Extension.LOWERCASE);

Just set myfilePath to be what ever you want (C:\myfolder\myfile.jpg)

Answered By – Ghoul Fool

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published