skip to Main Content

So I have a personal website, and I have a button that I want to use to open photoshop and run a script for me. How do I do this?

3

Answers


  1. Chosen as BEST ANSWER

    This has been up for awhile, but if the solution to this in node is to use a child_process.

    you can npm install child_process

    and the code to run executables would be to do

    const exec = require("child-process").execFile;
    
    var process = exec("Photoshop.exe", [*add options here*], {cwd:"C:/*path to photoshop*"});
    

    you can do a lot of cool things afterwards like event handlers

    process.on("close", code => {
      console.log("process closed with code: "+ code)
    })
    
    process.on("exit", code => {
      console.log("process exited with code: "+ code)
    })
    
    process.stdout.on("data", data => {
      console.log(data)
    })
    

    You can read the Docs here: https://nodejs.org/api/child_process.html


  2. It is not possible. It would pose a huge security risk to allow javascript to open programs on client side.

    Login or Signup to reply.
  3. maybe this
    Code will open image in photoshop with the help of javascript. You just need to place your image file into photoshop->sample folder nothing more than that and you done with it.

    var fileRef = new File(app.path.toString() + “/Samples/test.jpg”); // ‘samples’ is a folder resides in Program FilesAdobeAdobe Photoshop CS5samples
    //open (fileRef);
    var doc = open(fileRef);
    // get document name (and remove file extension)
    var name = tempName[0];
    // convert to RGB; convert to 8-bpc; merge visible
    doc.changeMode(ChangeMode.RGB);
    doc.bitsPerChannel = BitsPerChannelType.EIGHT;
    doc.artLayers.add();
    doc.mergeVisibleLayers();
    
    // rename layer; duplicate to new document
    var layer = doc.activeLayer;
    layer.name = tempName[0];
    layer.duplicate(newDoc, ElementPlacement.PLACEATBEGINNING);
    // close imported document
    doc.close(SaveOptions.DONOTSAVECHANGES);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search