5 Replies Latest reply on Aug 25, 2017 7:08 AM by martinr84659894

    After Effects: Startup Script

    narinet19102436 Level 1

      I have declared some variables in startup script but actually they are not visible in after effects scope.
      But they are visible in after effects toolkit.


      Is there a way to make it visible in After Effects scope as well ?

        • 1. Re: After Effects: Startup Script
          haraujo7688 Level 2

          Maybe you are declaring it inside a function?

          Having part of the code would help spot whats going on.




          • 2. Re: After Effects: Startup Script
            narinet19102436 Level 1

            Currently we are using this expression code to get some text information from comment.txt file:

            var aa = $.evalFile("file://C:/node/templates/2/comment.txt");


            The matter is that we need to pass the path of the comment.txt runtime.
            For that purpose we used script,  and from script we would like to access app.project to access to some variables for changing, but the app is not visible from AE it is only visible in toolkit
            SO is there some way how we can organize to get this path "file://C:/node/templates/2/comment.txt" dynamicly ?

            • 3. Re: After Effects: Startup Script
              martinr84659894 Level 3

              We already found out, that there is no way to "connect" an expression with a script, didn't we?


              You really should read the scripting manual...


              However, I just realized that you are using an absolute path for your text file. I'm pretty sure, you can create a relative path as well.


              This expression worked for me once:

              myPath = "~/Desktop/r.txt";


              And you can create text files with a script... so just put the pieces together.


              It would be very helpful if you tell us the whole story. This is your third post - I think - but I still can only guess, what you are actual trying to do.


              Cheers again,


              • 4. Re: After Effects: Startup Script
                narinet19102436 Level 1

                The relative path didn't work anymore.



                The matter is I need to pass different path to the project each time.
                So if I write a script is there a way to pass the data from script to ae project or is there a way to modify text info of AE project from the script without absolute path ?


                Actually we create a video with after effects which contain authorized information for each user. So we would like to read that information each time for new user and insert in AE project specific layer.

                • 5. Re: After Effects: Startup Script
                  martinr84659894 Level 3

                  Thank you for those information.


                  As I already suggested in your other post, Templater Rig or CompsFromSpreadsheet plugins is what you need. They do exact that: take data from external source, insert them into a (text-) layer, put comp into renderlist and even start to render.


                  But these scripts requires a static location of your external data.


                  If you want to write it on your own, I would first check, if it is possible to establish a system, which works with fixed paths. Like: my "authorized information" is always next to the project file, so I can use project path and search for a *.txt.


                  If this is not possible, what is your plan to tell the script automatically, where the text file is located? It must look for this file somewhere...


                  Once you solved this, you can use the script to pass the information into a text layer, or create an expression. That's the easy part.


                  The last hard work have to be done, when it comes to automation. If think it's not possible to launch aerender.exe with a script. But you can launch AE with a script, which should be the same as the startup script function. Actual you don't need this all... you *just* need a script which periodically scans a resource for new data and creates or alternates and renders a comp every time new data arrives (Templater can do this). There is a way to utilize node.js, but my knowledge ends here.


                  I hope, this helps.