Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Splitting long script

  • Splitting long script

    Posted by Tudor Baican on August 24, 2023 at 8:49 pm

    Hello friends,

    Im looking for a solution to organize my extreme long script. I was thinking to split the some functions to separate files and load then load them through #include in the main script.

    The splited files should include: UI, clickEvent and different functions.

    I came to this solution what actually works, but im not sure if its a good and healthy way.

    What do you think?

    // main Window:
    var myWindow = new Window ("palette");
        #include myScripts/Script1.jsx
        #include myScripts/Script2.jsx
    myWindow.show();
    
    // splited Scripts:
    var myButton1 = myWindow.add ("button {text:'Button1'}");
    myButton1.onClick = function(){myButton1Function()};
    
    function myButton1Function(){
        alert("ok");
    };
    Hector Vera replied 1 year ago 2 Members · 1 Reply
  • 1 Reply
  • Hector Vera

    August 28, 2023 at 3:54 pm

    It looks pretty organized and its always good to add commentary on these codes when seperated so you can explain what is the main purpose for this line of codes of what a specific function can do. I think you got the idea. If its possible that they all still function while the line of codes are in seperate files, its more easier to navigate it by files instead of a long scroll down and searchbar to find the line of code you may want to work in. Best of luck on this! 🙂

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