skip to Main Content

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.

2

Answers


  1. Chosen as BEST ANSWER

    this worked for me:

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

  2. You can simply suppress any dialog boxes with this at the start of a script:

    // Switch off any dialog boxes
    displayDialogs = DialogModes.NO; // OFF 
    

    For debugging you can put them to ERROR displayDialogs = DialogModes.ERROR; or normal displayDialogs = DialogModes.ALL;

    Bearing in mind that this will change the state of Photoshop, so I’ve taken to adding them to all myscripts, switching them off to start with and switching them back on at the end.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search