Search code examples
javascriptphotoshopphotoshop-scriptphotoshop-cs5

How do I set the folder on a Photoshop script?


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)