• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

executing exe from CEP panel by clicking a CEP button

Contributor ,
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

688

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

Community Expert , 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.

Votes

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.

Votes

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
Community Expert ,
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.

Votes

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
Contributor ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

Thanks, Justin!

after some double checking the code started working!

 

Votes

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
Explorer ,
Nov 10, 2022 Nov 10, 2022

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.

Votes

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
Community Expert ,
Nov 10, 2022 Nov 10, 2022

Copy link to clipboard

Copied

LATEST

@guymi Can you create a new issue with a sample of your code? Thanks

Votes

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