2 Replies Latest reply on Aug 3, 2016 1:00 PM by kwfranz94841

    Open specific .psd in Photoshop with Javascript

    kwfranz94841 Level 1

      So I'm building an extension in Photoshop and would like certain buttons to open up specific .psd files when clicked. I found the code below in the CC_Extension_SKD.pdf which works to open up a new blank .psd file. How could I edit this code to open an existing, local .psd? I'm a designer, not a developer so I've been learning as I go, and any help would be appreciated! I've tried everything from this discussion How to open a file in Photoshop with javascript without any luck, so I figured I would post what I have that works and see if anyone can fill in the blanks. Thanks!

       

       

      index.html

      <button id="btn">Click me</button>

       

      hostscript.jsx

      function openFile() {

      app.documents.add();

      }

       

       

      main.js

      // Get a reference to a CSInterface object

      var csInterface = new CSInterface();

      var button = window.document.getElementById("btn");

      button.onclick = function() {

      // Call function defined in host/ps.jsx

      csInterface.evalScript("openFile()");

      };