Call afterOpen event from within CEP panel rather than startup scripts
Hiya,
I am attempting the pull some metadata from every file on open and use it to populate a list in a CEP panel. I have no problem getting the metadata, but I can't for the life of me get the eventlistener to work.
I thought I'd start from first principles and used the documentaion example code as a simplified test, but in reality the return value would be the metadata that was pulled from the file on open.
I have this in my main.js:
onLoad();
function onLoad(){
csInterface.evalScript('afterOpenEvent()', function(retVal){
console.log("afterOpen returns: " + retVal);
});
};
and then in my .jsx I have:
function afterOpenEvent(){
var myEventListener = app.addEventListener("afterOpen", myDisplayEventType);
function myDisplayEventType(myEvent){
var msg = "This event is the " + myEvent.eventType + " event."
return msg;
}
}
The onLoad() sucessfully calls afterOpenEvent(), but the script stops at the var myEventListener line in the .jsx.
I have found a load of other posts, but they're all talking about putting a headless script in the startup scripts folder, but I want it to run from my CEP panel.
Any help with this issue would be greatly appreciated, thanks!
