Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Referencing a file through 2 layers of Scripts in After Effects

  • Referencing a file through 2 layers of Scripts in After Effects

    Posted by Inch Bunmi on July 28, 2015 at 11:58 am

    Hi Guys,

    I am having an issue referencing a file through 2 AE scripts. Here is what I mean:

    Script1 (The actual Script that you run):
    scriptFile = new File(“C:/Scripts/Script2.jsx”);
    $.evalFile(scriptFile);

    Script2:
    //Create Null//
    var myNull = curItem.layers.addNull(curItem.duration);
    myNull.name = “Scale_Null”;
    //Change Null Scale to an Expression//
    var ActionFile = File(“Scale.js”);
    var ActionFileText = ActionFile.open(“r”);
    var ActionFileTextRead = ActionFile.read();
    curItem.layer(“Scale_Null”).scale.expression = ActionFileTextRead;

    Scale.js:
    A = thisComp.width;
    [A, A];
    _____________________________

    What I want:
    1. Script1 is supposed Launch Script2
    2. Script2 is supposed to create a Null and then reference a .js file which will be used as the expression for the Null’s scale.

    Problem:
    1. Script1 Launches Script 2 fine.
    2. Script2 creates the null.
    3. Script2 refuses to reference the .js file
    4. BUT When I launch Script2 directly (bypassing script1), The .js file is referenced and then used as the Null’s Expression.

    Please Help

    Inch Bunmi replied 11 years, 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Walter Soyka

    July 28, 2015 at 3:05 pm

    Perhaps the working directory is different in these two cases? What is the path to Scale.js?

    Walter Soyka
    Designer & Mad Scientist at Keen Live [link]
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    @keenlive   |   RenderBreak [blog]   |   Profile [LinkedIn]

  • Inch Bunmi

    July 28, 2015 at 3:18 pm

    I figured and solved the problem.

    Script2 was missing a file location. So by adding “c:/Scripts/” to the Script2 file, I was able to direct the file referencing.

    *All 3 files (Script1, Script2 & Scale.js) are placed in the same directory.

    Thank you for the response.

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