Copy link to clipboard
Copied
I want to get the fontsize using AEGP_ExecuteScript, but I don't how to use it,please give me an example. thanks!
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);
...
Copy link to clipboard
Copied
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-utility...
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));
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
I use the AE SDK that i can call those functions, if i need import some sdk about script ?
Copy link to clipboard
Copied
You can either run scripts directly from C++ with this method, or just call the name of an existing script in ExtendScript that you've already created.
Copy link to clipboard
Copied
how can i read the fontSize value from outResultPH?
Copy link to clipboard
Copied
Here's what I have documented, it's been a while since I've tested it, but you basically need to lock the memory handle and then cast the value to an A_char, and then cast it to a string if you like.
A_char *res = NULL;
ERR(suites.MemorySuite1()->AEGP_LockMemHandle(outResultPHs, reinterpret_cast<void**>(&res)));
std::string strRes = res;
Copy link to clipboard
Copied
Thanks, your answer helped me a lot.