Quantcast
Channel: Adobe Community : Popular Discussions - After Effects SDK
Viewing all articles
Browse latest Browse all 73444

AEGP_ExecuteScript

$
0
0

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;

}

 


Viewing all articles
Browse latest Browse all 73444

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>