executing exe from CEP panel by clicking a CEP button

Participant ,
Jun 07, 2021 Jun 07, 2021

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. 

 

 

TOPICS
SDK, User interface or workspaces

Views

251

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Jun 07, 2021 Jun 07, 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.

Likes

Translate

Translate
Adobe Employee ,
Jun 07, 2021 Jun 07, 2021

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 07, 2021 Jun 07, 2021

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

LATEST

Thanks, Justin!

after some double checking the code started working!

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines