'run exe on click of the button using js node in Adobe CEP
I'm developing a js CEP panel for Adobe Premiere Pro. I know how to run exe concurrently with my panel. Here is a simple code and it works:
var csInterface = new CSInterface();
const exec = require('child_process').exec;
exec("myPath\\myApp.exe", function(err, stdout, stderr) {});
However if I want to run my exe file after clicking a button and add:
var openButton = document.querySelector("#open-button");
function openDoc() {
const exec = require('child_process').exec;
exec("myPath\\myApp.exe", function(err, stdout, stderr) {});
}
the button doesn't work. How to solve this problem?
Solution 1:[1]
You can use Extendscript native method File.execute()
Add function to Main JSX:
function executeFile(path) {
exeFile = File(path);
if (exeFile.exists) {
exeFile.execute();
} else {
alert("File not Found");
}
}
Main JS:
///onClick
EXEPath ="path of executable file";
csInterface.evalScript('executeFile("' + EXEPath + '")');
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |