Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Is there any entry command that can be called by scripts?

Explorer ,
Mar 22, 2019 Mar 22, 2019

Hi,

I am now working on a PF plugin. There is a button which trigers a script window run by ExecuteScript. And there is also a button in my script window. What I want is that when I click the "Apply" button in script window, my plugin should recieve a command that can send my data from script window back to my arbitrary data in my PF plugin. (Like what adobe have done with Color Parameter, when you change color in Color Picker window, the color param can get the color data real time)

ZzStarSound
TOPICS
SDK
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 23, 2019 Mar 23, 2019

There is no easy way I know of.

ExecuteScript was originally intended to be run modally, i.e. run a script synchronously once in the foreground and get an optional result/return code back while all other processes are blocked. So you can return values directly to your effect plugin onyl after your script has run, and also only once, not continually. Maybe C++ script extension plugins or whatever they are called could be a step in that direction, but you'll probably still end up with lots of weird issues.

We once did a more complex configuration that as far as I remember went like this: one effect plugin that starts a script with non-modal dialogs. Another AEGP plugin that registers command hooks with AE. The script dialog sends data to the command, which in turn gets assed to the AEGP plugin. The AEGP plugin processes this data and shares it internally with the regular effect plugin. This approach can be really convoluted and you really have to know what you are doing and it also might break easily, so not really recommended.

I remember some other wild approaches by other people, like trying sending data from the script using local sockets back to the plugin, but I think that failed.

If anyone knows of an easy and currently working solution, let us know.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 23, 2019 Mar 23, 2019

you can write an extention DLL, which allows to define javascript functions

that re executed on the DLL. meaning, on the javascript side you can call a

function that triggers a DLL's C function that can pick up the execution

from there.

on the Extendscript Tools installation folder there's an "SDK" folder with

some samples.

you'll still need to figure out how to connect between that DLL and AE's

API...

On Sat, Mar 23, 2019 at 9:46 AM Toby (reduxFX) <forums_noreply@adobe.com>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 25, 2019 Mar 25, 2019

it's maybe not themore appropriate way, but in a similar case I used a json solution.

On the plugin side I include a json parser  lib  (evyrthing is in a header (like https://github.com/nlohmann/json  or some smaller lib).

On  script I use jsonjs GitHub - douglascrockford/JSON-js: JSON in JavaScript  (thanks shachar in a previous thread).

The script is called with userChangedParam. the data comes from the arb to json.

the script part  send data  to json and the plugin parse the result  in order to  send it back to arb.

my code is here if you want to have a look. (in the dialog.cpp file).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 25, 2019 Mar 25, 2019

But in your solution it is still only a one time return call, right?

I understood the original poster in a way that the dialog window should stay constantly open and each change of a value in the dialog is transferred to the plugin, so not the simple ExecuteScript() / evaluate return value approach.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 25, 2019 Mar 25, 2019

Ha you maybe right..  Does the "Apply"  button close the script Window ?  I understood that the script was called from plugin, then does some stuff and send data to plugin when it's closed...

If not sorry, I'm wrong.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 25, 2019 Mar 25, 2019

Thanks for sharing your approach!

Sorry for confusing, the "Apply" button only send data and does not close the script window, which means the script window should run asynchronously.

Thanks again for all of you guys approachs. Base on the discussion above. I will try to add an event loop to scan script data periodically.

ZzStarSound
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 25, 2019 Mar 25, 2019

But how are you gonna do this? How are you gonna "scan script data"?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 26, 2019 Mar 26, 2019

Ae will not delete data you saved to global script variables (I learned this features in ExtendScript). Means, it maybe as same as ExecuteScript because inside the API there must be a same approach when ExtendScript links to Ae.

ZzStarSound
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 26, 2019 Mar 26, 2019
LATEST

Yes, I as more thinking of the c++ side.

So you want to regularly call ExecuteScript() from inside your plugin to get the current data from the scripting engine, right?

Not sure how well that goes performance wise, but please try and report back

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines