Inventsable / bombino

Supercharged Adobe CEP panel generator for Vue with dynamic template support for Vue-CLI and Quasar-CLI
MIT License
98 stars 16 forks source link

Script (/src/host/PPRO/host.jsx) are not loaded in development mode or are they loaded inside an iframe? #24

Closed Inaztm closed 2 years ago

Inaztm commented 3 years ago

Hi. In development mode, trying to execute

__adobe_cep __.evalScript('typeof importTimeline', (res) => console.log(res))

image 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?

Inaztm commented 3 years ago

?

Inaztm commented 3 years ago

Probably the problem is in the panel component where the scripts are loaded. evalScript is executed with "import {evalScript} from" cluecumber ""

Inaztm commented 3 years ago
Screenshot 2021-10-05 at 10 59 43
Inventsable commented 2 years ago

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).

Inventsable commented 2 years ago

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);
});
Inventsable commented 2 years ago

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