1 Reply Latest reply on Dec 10, 2011 1:30 AM by c.pfaffenbichler

    Photoshop Action Question How to Avoid Replace Files Dialogue Box

    kmc27 Level 1

      I have Photoshop CS3 running on a Macintosh. This Photoshop action on this Mac opens PDFs and saves them as a JPEG to a folder on a server.


      Sometimes the originating file will be modfied, so a new PDF will be created and have to go through the action again. The intent is for the action to overwrite the preexisting JPEG file(s) on the server, because they are out of date and must be replaced.


      The photoshop action on the Mac converts the new PDF to a JPEG, but then stops and shows a "Replace Files" dialgue box, which displays a listing of the name(s) of the JPEG(s) that will be overwritten. The dialogue box reads "Some of the specified files already exist in the target location. The files marked will be replaced." Below that message are two buttons to choose from, "Cancel" and "Replace". I always click "Replace"


      Is there a way to get the the action, (which specifically reads, "With Save Image Files" on the part of the action where it saves the jpg),  to just go ahead and overwrite the existing JPEG file(s) on the server without presenting the dialogue box?

        • 1. Re: Photoshop Action Question How to Avoid Replace Files Dialogue Box
          c.pfaffenbichler Level 9

          I can’t test on CS3, but I think the affected features should not have changes since CS3.

          Anyway, I think an Action cannot perform what you want, a Script should be able to, though.

          You could adapt the following code by changing the variable docPath to the correct path of the Folder you want to save the jpgs into.


          If you want to give it a try, paste the following text into a new file in ExtendScript Toolkit (part of Photoshop’s installation, Applications/Utilities/Adobe Utilities/ExtendScript Toolkit CS3, I guess) and save it as a jsx-file into Photoshop’s Presets/Scripts-folder.

          After restarting Photoshop the Script should be available under File > Scripts and can be assigned a Keyboard Shortcut directly, recorded into an Action or started from ExtendScript Toolkit directly.


          // saves jpg into same folder;
          // be advised: this  overwrites existing jpgs of the same name without prompting. 
          // 2010, use it at your own risk;
          #target photoshop;
          if (app.documents.length > 0) {
          var thedoc = app.activeDocument;
          // getting the name and location;
          var docName = thedoc.name;
          if (docName.indexOf(".") != -1) {var basename = docName.match(/(.*)\.[^\.]+$/)[1]}
          else {var basename = docName};
          // getting the location, if unsaved save to desktop;
          try {var docPath = thedoc.path}
          catch (e) {var docPath = "~/Desktop"};
          // jpg options;
          var jpegOptions = new JPEGSaveOptions();
          jpegOptions.quality = 9;
          jpegOptions.embedColorProfile = true;
          jpegOptions.matte = MatteType.NONE;
          //save jpg as a copy:
          thedoc.saveAs((new File(docPath+"/"+basename+".jpg")),jpegOptions,true);
          //that’s it; thanks to xbytor;