Hello
I have a problem using script from sdk.
When in script editor I run this code, my project load with any problem
function openProject(filename) {
if (app.project != NULL)
app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES);
var myFile = File(filename);
if (myFile.exists)
app.open(myFile);
else
writeLn("no such file or directory!");
}
openProject("C:\\MonDossier\\bandeau défilant.aep");
But when my plugin call, this function, After Effect crash "an strange error with ae.blitpipe"
/* some includes here! */
#include <AEGP_SuiteHandler.h>
#include <AE_GeneralPlug.h>
#define OPEN_PROJECT "function openProject(filename) { \
if (app.project != NULL) \
app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES); \
var myFile = File(filename); \
if (myFile.exists) \
app.open(myFile); \
else \
writeLn(\"no such file or directory!\"); \
} \
openProject(\"%s\");"
std::string Do(SPBasicSuite* sp, AEGP_PluginID id)
{
std::string lReturnedValue;
try
{
A_Err err = A_Err_NONE;
AEGP_SuiteHandler(sp);
AEGP_MemHandle resultMemH = NULL, errorMemH = NULL;
A_char *resultAC = NULL, *errorAC = NULL;
A_char scriptAC[AEGP_MAX_MARKER_URL_SIZE] = {'\0'};
A_bool encodingB = TRUE; // my file to load may have non ascii char
sprintf(scriptAC, OPEN_PROJECT, "C:\\\\MonDossier\\\\bandeau d\u00E9filant.aep");
ERR(suites.UtilitySuite5()->AEGP_ExecuteScript(id, scriptAC, encodingB, &resultMemH, &errorMemH));
bool lAnErrorOccured = (err == A_Err_NONE);
ERR(suites.MemorySuite1()->AEGP_LockMemHandle(resultMemH, reinterpret_cast<void**>(&resultAC)));
ERR(suites.MemorySuite1()->AEGP_LockMemHandle(errorMemH, reinterpret_cast<void**>(&errorAC)));
lReturnedValue.assign(resultAC, strlen(resultAC));
if (lAnErrorOccured)
{
lReturnedValue.append("ERROR: ");
lReturnedValue.append(errorAC, strlen(errorAC));
}
ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(resultMemH));
ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(errorMemH));
}
catch(...)
{
/* Do something here! */
}
return lReturnedValue;
}