Skip to main content
Participant
November 2, 2021
Question

Photoshop API: Execute Action: Custom (JS) Script ?

  • November 2, 2021
  • 1 reply
  • 1277 views

Hello! I'm wondering if it's possible to use the Photoshop API to do the following:

 

1. create new file/artboard at specific resolution

2. run a custom Photoshop script written in Javascript

3. (save output as PNG to my node server)

 

I see the API reference has an Execute Action post method but I'm not clear how I would setup the action? Would I make my script a photoshop action, export it, and upload it to a cloud service with a public web url?

 

Thanks! 🙂

 

This topic has been closed for replies.

1 reply

Stephen Marsh
Community Expert
Community Expert
November 2, 2021

I'm not sure about the API, however, one can call a JavaScript from a JavaScript. No need to put the script call into a doAction.

 

 

// GUI
(function () {
    var selectJSX = File.openDialog("Select a JSX file to open", "Select:*.jsx");
    if (selectJSX === null) return;
    var cleanJSXpath = selectJSX.fsName.toString();
    $.evalFile(File(cleanJSXpath));
}());

// or

// No GUI
$.evalFile(File('~/Desktop/myScript.jsx'));