Closed Inaztm closed 2 years ago
?
Probably the problem is in the panel component where the scripts are loaded. evalScript is executed with "import {evalScript} from" cluecumber ""
Hi, you can't directly invoke __adobe_cep__.evalScript
as of 2018 (at least reliably, this tends to fail for After Effects). As of CEP 11 as well, you cannot invoke evalScript
from within an iframe which is the reason for this issue.
I'm not sure what your outlined sections in the above screenshot mean. The evalScript
imported from the cluecumber library is just a promisified wrapper around a generic evalScript
to allow async/await in your first outline, and the second outline is the required code necessary for Adobe Animate (notice that the first ternary block catches all conditions for any app that is not FLPR).
You also cannot do this:
__adobe_cep __.evalScript('typeof importTimeline', (res) => console.log(res))
This is equivalent to running a JSX file containing:
typeof importTimeline
It will execute but that's clearly not what you're solely intending to do. You'd have to wrap it in an anonymous function to explicitly return a value, like so:
let result = await evalScript(`(function(){ return typeof importTimeline }())`);
console.log(result);
Or without workaround
/async evalScript:
evalScript(`(function(){ return typeof importTimeline }())`).then((result) => {
console.log(result);
});
As of CEP 11 as well, you cannot invoke evalScript from within an iframe which is the reason for this issue.
While this portion of my comments is no longer the case, the rest is still applicable. Going to go ahead and close this
Hi. In development mode, trying to execute
but as a result "undefined". Question: Script (/src/host/PPRO/host.jsx) are not loaded in development mode or are they loaded inside an iframe?