[英]run exe on click of the button using js node in Adobe CEP
我正在为 Adobe Premiere Pro 开发一个 js CEP 面板。 我知道如何与我的面板同时运行 exe。 这是一个简单的代码,它可以工作:
var csInterface = new CSInterface();
const exec = require('child_process').exec;
exec("myPath\\myApp.exe", function(err, stdout, stderr) {});
但是,如果我想在单击按钮后运行我的 exe 文件并添加:
var openButton = document.querySelector("#open-button");
function openDoc() {
const exec = require('child_process').exec;
exec("myPath\\myApp.exe", function(err, stdout, stderr) {});
}
按钮不起作用。 如何解决这个问题呢?
您可以使用 Extendscript 本机方法File.execute()
将 function 添加到 Main JSX:
function executeFile(path) {
exeFile = File(path);
if (exeFile.exists) {
exeFile.execute();
} else {
alert("File not Found");
}
}
主要JS:
///onClick
EXEPath ="path of executable file";
csInterface.evalScript('executeFile("' + EXEPath + '")');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.