passing parameter from javascript to c++ when both are running in the same time

  adobe, c++, javascript

I have a java script (cep panel) which works inside Adobe Premiere Pro.

When my UI button is clicked I’m able to read out the position of the time slider. At the moment I can despatch a js event with event.data yielding this position.

Concurrently, I have a separate .exe process with additional UI (myPlugin.exe). myPlugin.exe is to listen for this event, and I should feed this event.data into it. myPlugin.exe is written in c++.

What is the best way to make c++ catch this event and read out the position of the slider?

At the moment my javascript code looks like this: (snippet from .js file):

var insertButton = document.querySelector("#insert-button");
insertButton.addEventListener("click", openDocument);

var sliderEvent = new CSEvent("slider", "APPLICATION");

function openDocument(){
csInterface.evalScript('openDocument('+')', function(response) {
  sliderEvent.data = JSON.parse(response);
  new csInterface.dispatchEvent(sliderEvent);
  alert(sliderEvent.data); // this  sliderEvent.data should be passed into my c++ file 
}) 
}

and the .jsx script:

function openDocument(){
    var CTI_seconds = app.project.activeSequence.getPlayerPosition().seconds;// player position in seconds;
    return CTI_seconds;
}

May be I shoould use stdout in javascript instead of dispatch event?
What is the best way to achieve the fasted transfer time?

Source: Windows Questions C++

LEAVE A COMMENT