Copy link to clipboard
Copied
Dear PPro fellows,
Here is the code which runs CEP panel concurrently with my exe file (index.js file):
var csInterface = new CSInterface();
const exec = require('child_process').exec;
exec("myPath\\myApp.exe", function(err, stdout, stderr) {});
This code works just fine.
However, I'd like to start my myApp.exe after the user clicks a button.
What I tried to do is as follows:
I added:
var openButton = document.querySelector("#open-button");
openButton.addEventListener("click", openDoc);
function openDoc() {
const exec = require('child_process').exec;
exec("D:\\Yaroslav2021\\anytex\\anytex.exe", function(err, stdout, stderr) {});
}
This doesn't work.
As far as I now understand node.js functions don't work in buttons so straighforwardly. Could you hint me what to do? May be a single code line can solve this problem?
Yaroslav.
Nothing is standing out as as incorrect with your code, just make sure you're testing the exact same function in multiple plcaes to check what the issue is, like log the err, stdout, stderr, check the file exists with fs.existsSync(), and maybe throw the whole thing in a try/catch.
Copy link to clipboard
Copied
Sorry, no idea. My experience is confined to Premiere Pro's APIs; I have no relevant experience using node.js from CEP panels.
Copy link to clipboard
Copied
Nothing is standing out as as incorrect with your code, just make sure you're testing the exact same function in multiple plcaes to check what the issue is, like log the err, stdout, stderr, check the file exists with fs.existsSync(), and maybe throw the whole thing in a try/catch.
Copy link to clipboard
Copied
Thanks, Justin!
after some double checking the code started working!
Copy link to clipboard
Copied
Please may I ask, what did you do to make this work? I can't get the button to work either.
Copy link to clipboard
Copied
@guymi Can you create a new issue with a sample of your code? Thanks