0 Replies Latest reply on Nov 17, 2017 7:55 AM by mellis-merlinone

    Photoshop CC 19.0.1 - ExtendScript method Document.saveAs() overwrites file with active document

    mellis-merlinone

      In Photoshop CC 19, there is a critical ExtendScript bug. The crux of the issue is this: regardless of the Document instance on which you invoke the saveAs() method, the data written out will ALWAYS be that of the active (frontmost) document in Photoshop.  This can easily result in data loss if the saveAs operation is being performed on a document instance that is not the frontmost (as its file will be replaced with the data from the active tab).

       

      Steps to reproduce:

      1. Open two documents - I used JPGs for testing  (let's call them "Image1.jpg" and "Image2.jpg")

      2. Make sure "Image 2" is the active (frontmost) document in Photoshop.

      3. Using the ExtendScript toolkit, connect to Photoshop CC 19

      4. Type the following into the JavaScript console window:

      app.documents.getByName("Image1.jpg").saveAs(new File("/path/to/your/save/location"))

       

      You will find the data written to the "/path/to/your/save/location" file "Image2.jpg" data NOT the "Image1.jpg" data you requested.