AEGP_ExecuteScript

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;

Instead of loading a project I change the script command to create a new project. And I have a message about "an error during OpenGL render process".
that's why I think it's a threading problem.
Details about my project:
My goal is to "drive" After Effect by network (UDP multicast), drive is not the true word, my plugin just load a specified project, and after user done (or not) their job, save a copy of their project. It is for student evaluation program.
Multicast UDP has been choose due to a large amount of "after effect to drive".
Project to load is send by "evaluation supervisor" with a file transfer embedded in my After Effect plugin, and this project is the same for all student in one evaluation group.
At the end, the "evaluation supervisor" send a save command, all projects are saved localy then send over network.
The send/receive are done, the save command works, but the load project failed.
In the first time, I think my file transfer failed but, the file is OK, and can be load using "File>Load a Project".

Similar Messages

  • AEGP_UtilitySyite5::AEGP_ExecuteScript() doesn't do anything in my effect plugin. why?

    Bonjoir All of you!,
    I'm developing a Effect plugin and I wanted to execute some script using the AEGP_UtilitySyite5::AEGP_ExecuteScript() function. I have supplied all the parameters to this function. this function executing, but not doing anything. If I execute the same script via File -> Scripts -> Run Script File, then its working prefect. Why it doesn't do anyhting if I execute using the above function? what could be the reason for this?? am I missing anything??
    Please any suggestions...
    Thanks
    Manjunath

    Hello Shachar,
    I have developed 2 effect plugins:     1. plugin for creating UI only and
                                                        2. plugin for lanching the script only.
    You already knew that, My script is purely based on setting expressions to parameters. These params are nothing but UI items in the UI plugin.
    some where in the script calls the UI plugin and set the expressions.
    So, what I did is:
         1. Loaded /applied the script effect plugin
                   this automatically calls UI effect plugin and Ui will be displayed.
         2. UI is displayed in Effects Control Window (ECW) fine.
         3. Exressions are also set byb the script plugin using the script.
         this working fine, i.e., script is launched. No crash.
         but getting an error "After Effects error: Internal verification failure".
         error bmp file attached here.
    I observed that:
         1. sometimes script is launched with out any error. 100% working fine.
         2. sometimes getting an error shown in attached bmp file
         3. sometimes getting crash in AE.
         4.  the script file, which is no relation (or communication) with the ECW, then that script file executing with out any errors.
              If the script file is has relation with the ECW( like in our case, set the expressions to ECW UI params), then that script file 
              executing fine sometimes and getting error some times.
    [ I think you understand the above 4th point ]
    Now tell me, what could be the reson for this getting error?

  • 'AEGP_ExecuteScript': identifier not found

    Hey guys,
    I'm trying to execute a script from withing the panelor example from  sdk6.
    PanelatorUI_Plat.cpp
    case WM_COMMAND:
    if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == BtnID){
    i_numClicks++;
    AEGP_ExecuteScript(NULL, "alert('X');", FALSE, NULL, NULL);
    InvalidateAll();
    handledB = true;
    It won't compile => 'AEGP_ExecuteScript': identifier not found..
    no idea what I'm doing really
    thanks !

    hmm still not working..
    in VS when I hover over the AEGP_UtilitySuite5() part of this code:
    suites.AEGP_UtilitySuite5()->AEGP_ExecuteScript(NULL, "alert('X');", FALSE, NULL, NULL);
    It says error: class "AEGP_SuiteHandler" has no member "AEGP_UtilitySuite5"
    but when I check the AEGP_Suithandler.h file there this line:
    AEGP_UtilitySuite5
    *utility_suite_5P;
    so tried the following:
    AEGP_SuiteHandler::Suites::utility_suite_5Psuites()->AEGP_ExecuteScript(NULL, "alert('X');", FALSE, NULL, NULL);
    when I then hover over the "Suites" part is says:
    error: class "AEGP_SuitHandler::Suites" declared at line 89 of "path...\AEGP_Suitehandler.h" is inaccessible
    I feel we're getting closer ...

  • Parameter (const A_char* inScriptZ) description in AEGP_ExecuteScript( ) function?

    Hi,
    The prototype of AEGP_ExecuteScript() is
    SPAPI A_Err (*AEGP_ExecuteScript)(AEGP_PluginID inPlugin_id, const A_char* inScriptZ,// in const A_Boolean platform_encodingB, AEGP_MemHandle* outResultPH0, AEGP_MemHandle* outErrorStringPH0);
    What is the second parameter "const A_char* inScriptZ" describes?
    Is it path of the script file or direct script only?
    Thanks
    Manjunath

    It is a script text not a file.

  • How can I get the pluginID in Effect type plugins?

    Hi,
    I am craeting Effcet plugin and I want to get the PluginID because I want to execute the script file using AEGP_ExecuteScript() function?.
    so Could you please tell me how can I get the pluginID in Effect plugins?
    Thanks
    Manjunath G

    Hi Mylenium,
    Thanks for your reply.
    see the below function prototype...
    SPAPI A_Err (*AEGP_ExecuteScript)(AEGP_PluginID inPlugin_id, const A_char* inScriptZ,// in const A_Boolean latform_encodingB,// in AEGP_MemHandle* outResultPH0, AEGP_MemHandle* outErrorStringPH0);
    I am developing a Effect plugin and I want to execute the script by using above function. So, How can I get the pluginID from the AfterEffects?
    I have seen the sample SDK projects. In the AEGP (floder) SDK samples, the EntryPointFunc function prototype itself there is a pluginID.
    See the EntryPointFunc() prototype...
    EntryPointFunc( struct SPBasicSuite *pica_basicP, A_long major_versionL,
    A_long minor_versionL,
    const A_char *file_pathZ, const A_char *res_pathZ,
    AEGP_PluginID aegp_plugin_id, void *global_refconPV);
    I hope, you understood my problem?
    Thanks
    Manjunath

  • Text justification using AEGP

    Is it possible to retrieve the text justification of a text layer using AEGP suites ?
    The jsx equivalent is
    var just = layer.property("ADBE Text Properties").property("ADBE Text Document").value.justification;
    Thanks

    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));

  • XMP metadata access in Effect plugin

    Hi everyone,
    I was wondering if there is a way to access file's XMP metadata from the Effect plugin, like you can do in scripting using XMP scripting API?

    hi Bart Walczak! welcome to the forum!
    i don't know of a direct way using the C API. you can however get the source footage for your layer, get the path to the file and access it directly.
    you can also use AEGP_ExecuteScript() to access the data through the javascript API (i don't know how, but you say it can be done), and retrieve the result back to the C side.

  • After Effects crash when calling ProjSuite5()- AEGP_OpenProjectFromPath

    I'm running 12.2
    I have code that opens a project.
    The only time this code doesn't make after effects crash is in the ImportFile command method; however, I'm trying to run a server ontop of my plugin so I can control after effects remotely.
    AEGP_ProjectH projH = NULL;
    AEGP_SuiteHandler suites(S_sp_basic_suiteP);
    A_UTF16Char templatePath[AEGP_MAX_PROJ_NAME_SIZE];
    const wchar_t* wide_templatePath = L"C:\\Projects\\TT1.aep";
    copyConvertStringLiteralIntoUTF16(wide_templatePath, templatePath);
    ERR(suites.ProjSuite5()->AEGP_OpenProjectFromPath(templatePath, &projH));
    I click debug and hook into visual studio and it's saying.
    Unhandled exception at 0x000000003201B840 (Projector.aex) in AfterFX.exe: Stack cookie instrumentation code detected a stack-based buffer overrun.
    I've even tried registering into the IdleHook and it still crashes.. Any ideas?

    I ended up calling ExecuteScript and hooking into the importfile callback.
    A_char* scriptAC = "app.project.importFile(new ImportOptions(new File(\"test.vmp\")));";
    ERR(suites.UtilitySuite5()->AEGP_ExecuteScript(S_my_id, scriptAC, FALSE, NULL, NULL));

  • Duplicate and Move a Layer

    Is there a good way to duplicate a layer in one composition and then move it to another composition? I'm very new to the SDK so I apologize if there is an obvious answer.
    Thanks,
    Jesse

    dude, you have no idea how problematic that simple thing you asked is.
    you can duplicate effects, layers and masks using the c++ api, but you can't move them as they are to a new target.
    this not-so-helpful thread is a good example: http://forums.adobe.com/message/1799202#1799202
    but not all hope is lost!
    you have a few options:
    1. do it yourslef.
    get the source footage of the layer you wish to copy, put that source in the new comp.
    then copy that layer's properties one by one, and it's effects... one by one, and their params.....  one by one...
    it's a hassle to program, but once you're done it's good for all eternity.
    2. try to mimic copy/paste.
    you can use AEGP_DoCommand() to force AE to use it's own copy and paste methods.
    the command numbers are: copy 19, paste 20
    i never tried doing that, so it's all theory.
    and you'll need to be able to tell AE what comp to paste into, which i can't remember how to do (if at all possible) off the top of my head.
    3. java.
    if you can do that using java script, you can run java code from within you effect.
    AEGP_ExecuteScript() will do the trick.
    notice that it doesn't run an external jsx file. it runs the code you feed it via a char* array.
    that's all i can think of right now.
    sorry... no swift solution. (unless my brain has shriveled and the simple solution is right under our nose)

  • Getting "Unable to run script at line 1: syntax error"  error?

    Hi,
    I want to run a script using the AEGP_ExecuteScript() function. but I got an error "Unable to run script at line 1: syntax error". what could be the rea son for this? shall I inlcude anything extra info in my project?
    Below is the code ...
    char scriptPath[] = "F:\\Documents and Settings\\akshays\\Desktop \\Active Shutter.jsx";
    A_Boolean platform_encodingB = 'B';
    AEGP_MemHandle outResultPH0;
    AEGP_MemHandle outErrorStringPH0;
    utilitySuite5->AEGP_ExecuteScript( pluginID, scriptPath, platform_encodingB, &outResultPH0, &outErrorStringPH0 );
    please help me.
    Thanks
    Manjunath

    This can be debug by using "ExtendSCript Toolkit 2 and Debugger".
    Just open Edit -> Prefernces -> General -> ****
    There enable checkbox "Enable javascript debugger".
    if you encountering an error while launching the script, then AE will automatically open your script in "ExtendSCript" toolkit with an error at the bottom line. You can see the "DataBrowsing" panel right side for available functions., objects and so on.
    then you can get to know what is the error and the reason for this error at least.

  • How to activate Time Remapping ? (CS5)

    Hi.
    I try to activate time remapping on a Layer, without success.
    I tried AEGP_SetLayerFlag without.
    I tried the Do_Command hint from here http://forums.adobe.com/message/1799231#1799231 nothing worked.
    Here's my portion of code :
        ERR(suites.FootageSuite5()->AEGP_NewFootage(S_my_id,ANIM_pathZ, NULL,&options, AEGP_InterpretationStyle_NO_DIALOG_GUESS, NULL, &ANIMH));
        ERR(suites.FootageSuite5()->AEGP_AddFootageToProject(ANIMH, AnimationfolderH, &ANIM_itemH));   
        AEGP_LayerH       ANIM_layerH    = NULL;
        A_Boolean            is_add_validB        = FALSE;
        ERR(suites.LayerSuite5()->AEGP_IsAddLayerValid(ANIM_itemH, AnimationcompH, &is_add_validB));
        if (is_add_validB)
            ERR(suites.LayerSuite5()->AEGP_AddLayer(ANIM_itemH, AnimationcompH, &ANIM_layerH));
            ERR(suites.LayerSuite7()->AEGP_SetLayerFlag(ANIM_layerH,AEGP_LayerFlag_TIME_REMAPPING,tru e));
            ERR(suites.CommandSuite1()->AEGP_DoCommand(2153));

    i don't know why the AEGPDoCommand fails to deliver for you.
    you can however use AEGP_ExecuteScript() and use java from within your plug-in to enable the time remapping.
    here is a thread that shows the complete process of using AEGP_ExecuteScript:
    http://forums.adobe.com/message/3625857#3625857%233625857
    it actually goes into more trouble than you need.
    a simple AEGP_ExecuteScript("simplest java code to enable time remapping") will do the trick.

  • Is there a way to get the layer comment?

    Hi, Everyone.
    I'm having a problem.
    I can not find the API to get the layer comment.
    Could you please teach me?

    Thank you, shachar.
    you can always do that through AEGP_ExecuteScript(), and retrieve the
    result back to the c side.
    I’ll give it a try.

Maybe you are looking for