Skip to main content
Lollipops110
Participating Frequently
December 22, 2021
Answered

How to use AEGP_ExecuteScript?

  • December 22, 2021
  • 1 reply
  • 1517 views

I want to get the fontsize using AEGP_ExecuteScript, but I don't how to use it,please give me an example.  thanks!

This topic has been closed for replies.
Correct answer Justin Taylor-Hyper Brew

There should be an example in the SDK if I recall correctly. But here's some background on it:

https://ae-plugins.docsforadobe.dev/aegps/aegp-suites.html?highlight=AEGP_ExecuteScript#aegp-utilitysuite6

 

And here's an example:

AEGP_SuiteHandler suites(in_data->pica_basicP);
A_Boolean outAvailablePB;
AEGP_MemHandle outResultPH;
AEGP_MemHandle outErrorStringPH;

ERR(suites.UtilitySuite4()->AEGP_IsScriptingAvailable(&outAvailablePB));
ERR(suites.UtilitySuite4()->AEGP_ExecuteScript(NULL, "alert(123);", true, &outResultPH, &outErrorStringPH));

ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(outResultPH));
ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(outErrorStringPH));

1 reply

Justin Taylor-Hyper Brew
Community Expert
Community Expert
January 6, 2022

There should be an example in the SDK if I recall correctly. But here's some background on it:

https://ae-plugins.docsforadobe.dev/aegps/aegp-suites.html?highlight=AEGP_ExecuteScript#aegp-utilitysuite6

 

And here's an example:

AEGP_SuiteHandler suites(in_data->pica_basicP);
A_Boolean outAvailablePB;
AEGP_MemHandle outResultPH;
AEGP_MemHandle outErrorStringPH;

ERR(suites.UtilitySuite4()->AEGP_IsScriptingAvailable(&outAvailablePB));
ERR(suites.UtilitySuite4()->AEGP_ExecuteScript(NULL, "alert(123);", true, &outResultPH, &outErrorStringPH));

ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(outResultPH));
ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(outErrorStringPH));
Lollipops110
Participating Frequently
February 9, 2022

ERR(suites.UtilitySuite4()->AEGP_ExecuteScript(NULL, "TextDocument.fontSize", true, &outResultPH, &outErrorStringPH));

 

Why this code execution failed, prompting that TextDocument could not be found?

And, how i can get text layer's fontSize or fillColor and so on?

Justin Taylor-Hyper Brew
Community Expert
Community Expert
February 9, 2022

I'd open new issues for fontSize / fillColor and so on. If you're getting "TextDocument could not be found" then ExtendScript is working, you just have to debug why that's missing etc for your specific app.