Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Plugins with floating licenses disables calling functions in nested scripts?

  • Plugins with floating licenses disables calling functions in nested scripts?

    Posted by Martin Bollerup on December 11, 2012 at 1:11 pm

    Hello

    This morning I got the Sapphire plugin installed and suddenly all my functions in my nested scripts were undefined. When copied to the main script everything worked fine…

    My question is:
    Is there a way around this or is it some kind of “firewall” build into After Effects? It happens on ALL projects – even though I’m not using the Sapphire plugin.

    I haven’t got the chance to test if the nested scripts works with a valid license because we haven’t got enough for all designers and developers. And this is the way things work around here so a workaround would be greatly appreciated.

    Thanks,
    Martin

    /* nestedScript.jsx */

    {
    function testNestedFunction(str)
    {
    alert("This is a nested function saying: " + str);
    }
    }

    /* mainScript.jsx */
    {
    function loadExternalScript(path)
    {
    // [1] Create file object for the file you want to run.
    var nested_file = new File(path);

    // [2] Open the file for reading.
    nested_file.open("r");

    // [3] Read the file and evaluate the results.
    eval(nested_file.read());

    // [4] Close the file. That's it!
    nested_file.close();
    }

    loadExternalScript("some/path/to/nestedScript.jsx");
    testNestedFunction("I'm your function!");
    }

    Martin Bollerup replied 13 years, 4 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    December 11, 2012 at 4:17 pm

    I don’t have any way to test it (I don’t have Sapphire), but it sounds like a possible path or permissions issue. Did anything else change?

    Dan

  • Martin Bollerup

    December 11, 2012 at 4:31 pm

    No nothing else changed… But it seems like calling external functions is completely cut off.

    I’ll get back to you if I find a workaround or an explanation.

    Martin

  • Gary Oberbrunner

    December 12, 2012 at 1:16 pm

    Hi Martin; I haven’t heard of this problem before. Please contact support@genarts.com. They should be able to help you out.

    — Gary

  • Martin Bollerup

    January 15, 2013 at 2:12 pm

    Okay so I found a way to make all nested scripts part of the same scope. All functions needs to be bound to the first loaded script – the main script. And the function for loading nested scripts should be placed in main.jsx and this function should always be used for loading scripts – if you want it to be part of the same scope.

    I haven’t compiled and testet the code here but it should work.

    cheers,
    Martin

    //
    //main.jsx
    //

    this.loadExternalScript = function(path) {
    // [1] Create file object for the file you want to run.
    var nested_file = new File(path);

    // [2] Open the file for reading.
    nested_file.open("r");

    // [3] Read the file and evaluate the results.
    eval(nested_file.read());

    // [4] Close the file. That's it!
    nested_file.close();
    }

    loadExternalScript("nestedScript1.jsx");

    testAlert_1("called fom main.jsx")

    //
    //nestedScript1.jsx
    //

    loadExternalScript("nestedScript2.jsx");
    this.testAlert_1(str) = function(str) {
    alert("nested 1: " + str);
    }

    testAlert_2("called from nested 1");

    //
    //nestedScript2.jsx
    //

    this.testAlert_2(str) = function(str) {
    alert("nested 2: " + str);
    }

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy