Copy link to clipboard
Copied
I can't seem to find a definite answer about how to run an extendscript script using nodejs.
My use case would be something like:
- run nodejs script from cli, e.g. `node src/action.js`
- in nodejs file it'd run a subprocess lanching an extendscript script (e.g. create an empty doc, add a hello world text layer it)
It'd be great if I could also pass some params to be used in the the extendscript file (e.g. text content for layer).
Is this possible? I'm on mac, extendscript toolkit is not available by the looks of it.
Copy link to clipboard
Copied
To communicate via node.js, you must first develop an executable extension panel in Photoshop.
Interface development in extensions is similar to regular web development, and for script execution, CSInterface connects to Adobe CEP via evalScript.
If you don't know how to use CSInterface with Adobe CEP, please refer to the sample code link below to learn.
bbb999's premiere pro panel
https://github.com/Adobe-CEP/Samples/tree/master/PProPanel
Control Photoshop in the background via node.js?
If so, implement the code that responds by creating a client that responds to server requests inside the Photoshop panel via websocket or socket.io.
Two types of development are possible.
[General Web Development]
01. Implement a server that responds to client events for server requests using socket.io and socket-io.client. In response, certain functions can be executed via the CSInterface's evalScript.
[Socket response method in ExtendScript]
As far as I know https is not supported.
02. ExtendScript in Photoshop listens for requests on a specific port via a supported socket object. You need to set your headers carefully. When the server sends a query to a specific port, the waiting client executes the code in response.
Photoshop Scripting Documentation - Sockets
https://theiviaxx.github.io/photoshop-docs/Core/Socket.html?highlight=socket