Skip to main content
Inspiring
June 7, 2021
Answered

executing exe from CEP panel by clicking a CEP button

  • June 7, 2021
  • 2 replies
  • 1228 views

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. 

 

 

This topic has been closed for replies.
Correct answer Justin Taylor-Hyper Brew

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.

2 replies

Justin Taylor-Hyper Brew
Community Expert
Community Expert
June 7, 2021

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.

Inspiring
June 14, 2021

Thanks, Justin!

after some double checking the code started working!

 

Inspiring
November 10, 2022

Please may I ask, what did you do to make this work? I can't get the button to work either.

Bruce Bullis
Community Manager
Community Manager
June 7, 2021

Sorry, no idea. My experience is confined to Premiere Pro's APIs; I have no relevant experience using node.js from CEP panels.