-
1. Re: Text justification using AEGP
shachar carmi Apr 19, 2011 11:38 AM (in response to cbmb)i really don't see a way to do that with from the c++ API.
you can however do:
AEGP_ExecuteScript("layer.property("ADBE Text Properties").property("ADBE Text Document").value.justification");
that will execute the text as a script from within an effect (or AEGP).
very handy actually.
:-)
-
2. Re: Text justification using AEGP
gutsblow Apr 19, 2011 12:30 PM (in response to shachar carmi)@shachar AEGP_ExecuteScript executes Javascript, but can we get return values from it? I think the user asked how to get the Text Justification value.
-
3. Re: Text justification using AEGP
cbmb Apr 19, 2011 10:50 PM (in response to gutsblow)Thanks.
Of course that's only a workaround, but the ExecuteScript trick seems to work fine.
(script string)
#define TEXT_JUSTIFICATION_SCRIPT "function getTextJustificationForLayer(layerId) { \
var comp = app.project.activeItem; \
for (var i = 0; i < comp.numLayers; i++) \
if (i == layerId && comp.layer(i+1) instanceof TextLayer) \
return comp.layer(i+1).property(\"ADBE Text Properties\").property(\"ADBE Text Document\").value.justification; \
} \
getTextJustificationForLayer(%d);"(somewhere in the code)
AEGP_MemHandle resultMemH = NULL;
A_char *resultAC = NULL;
A_char scriptAC[AEGP_MAX_MARKER_URL_SIZE] = {'\0'};
sprintf(scriptAC, TEXT_JUSTIFICATION_SCRIPT, layerIndex);
ERR(suites.UtilitySuite5()->AEGP_ExecuteScript(S_my_id, scriptAC, FALSE, &resultMemH, NULL));
ERR(suites.MemorySuite1()->AEGP_LockMemHandle(resultMemH, reinterpret_cast<void**>(&resultAC)));
// get justification constant (6012,6013,6014)
int just = atoi(resultAC);
ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(resultMemH));


