Search code examples
photoshopphotoshop-script

Photoshop Javascript script - is there a way to not have to manually click ok when using saveAs?


I have a photoshop script thats working and does everything I need, except when I call the following in the last line of my script:


    var saveLocation = File("/Users/user/Desktop/cats/catT1"+i+".jpg");
    var config = new JPEGSaveOptions();
    config.quality = 10;

    app.activeDocument.saveAs(saveLocation, config);

It opens the saveAs window for me to click Save, then once I have it opens a JPEG options window in which I need to click OK.

I want to run this script over many items and so really need a way to automate / eliminate the clicking...

If I add displayDialogs = DialogModes.OFF; to my script, I see the following when running: error

Any help much appreciated.


Solution

  • this worked for me:

    yourPath = File('~/desktop/jpgFile');
    (jpg = new JPEGSaveOptions).quality = 12
    activeDocument.saveAs(yourPath, jpg, true)