Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Linking source text in text layers to an external .txt file

  • Linking source text in text layers to an external .txt file

    Posted by Jonathan Leduc on April 13, 2010 at 7:07 pm

    I have never posted online, because I always search everything on the internet and find the answers I need thanks to all of you!
    However because of maybe a learning curve thing, the question I have may seem easy for many of you! And hopefully it is!!
    So many apologies if this has been answered, but I’ve searched everywhere and the content I’ve found isn’t clear to me!
    (I just learned what a script was this morning! lol)

    And so this is my first official question on the internet )
    —–

    – I have a .txt file (with a single long column of numbers), that I’m always updating the numbers in.

    – I have an AE project (that is HUGE and complex), with several text layers throughout (around 90)

    – I want to link the text of each layer in AE (through an expression) to a single specific number from within this large external .txt file

    so that when I update the .txt file, all the various text layers (displaying numbers from the .txt file) update automatically.

    For example, my goal:
    The .txt looks like:

    21
    77
    8446
    4
    93

    and I have 5 text layers in AE that each display (specified through an expression), one of those numbers.
    I update the .txt file, AE updates the text layers accordingly.

    —–
    IS this even possible?? Please help me! Any advice would be so appreciated!!

    (I’m coming up with some charts and graphs as a volunteer for a cause and if I could have the numbers update the project file automatically that would be GREAT!)

    PS: I’ve found compsfromspreadsheet, and tried a “text from file” script but I couldn’t figure out how they worked, and what I could learn while playing with them makes me think they dont update themselves with the .txt

    Ben Rollason replied 15 years ago 4 Members · 12 Replies
  • 12 Replies
  • Ben Rollason

    April 20, 2010 at 4:57 pm

    You can use a simple javascript include statement pre CS4.

    After that it gets a little more complicated.

    Lloyd Alvarez has a workaround for CS5. Unfortunately, you still can’t use relative paths in AE expressions.

    https://www.graymachine.com/2009/04/expressions-and-external-documents-revisited/

    -Ben.

    vfx.benrollason.com

  • Arie Stavchansky

    April 27, 2011 at 7:39 pm

    I know this reply is coming in a bit over a year late, but is there a workaround for handling relative paths for expressions within the AEP file? Is there anything at all? It seems like a weak spot of expressions’ capabilities. Is there any way to at least get ahold of the absolute path to the AEP file itself?


    Arie Stavchansky | Demo Reel | Portfolio of Creative Work | Blog

  • Ben Rollason

    April 27, 2011 at 7:53 pm

    You can do it with scripting, but not with expressions.

    Expressions is a rather simplified language in many respects.

    -Ben.

    vfx.benrollason.com

  • Arie Stavchansky

    April 27, 2011 at 9:01 pm

    Scripting as in I have to launch AfterFX.exe, run a script, alter the sourceText.text line in my expression, then close AfterFX.exe? The startup time for AE on my Windows7 machine can get way too long, especially if I need to run multiple instances.

    So, my next question is if I can run a script on an AEP file without having AE actually open the file?

    Thanks!


    Arie Stavchansky | Demo Reel | Portfolio of Creative Work | Blog

  • Ben Rollason

    April 27, 2011 at 9:07 pm

    The script could read the external text file and set the source text for multiple layers for you. The script would need to be run from inside After Effects, unless you fancy writing a .aep file parser.

    Check out Extendscript, aescripts.com and aenhancers.com for some more scripting pointers.

    Ben.

    vfx.benrollason.com

  • Arie Stavchansky

    April 27, 2011 at 9:42 pm

    Is there an AEP file specification available? Have they opened up the specs?

    Also, is there a way with expressions only, to get ahold of the AEP file name instead of the path to the AEP file?


    Arie Stavchansky | Demo Reel | Portfolio of Creative Work | Blog

  • Ben Rollason

    April 28, 2011 at 8:13 am

    As far as I’m aware, no, no and no.

    Expressions are really only designed as a way to link things up internally within a project. There are a handful of hacks and workarounds, but generally consider expressions for stuff that works internally to AE and Extendscript scripts for anything that needs to have functionality within the OS or above / outside of AE.

    -Ben.

    vfx.benrollason.com

  • Arie Stavchansky

    April 28, 2011 at 2:17 pm

    Ben,

    Thank you for the advice and tips. Yes, I realize that expressions are very limited, but what irks me about the way scripting is implemented is that the Adobe developers assume a user needs to have After Effects open to operate on an AEP file. This is problematic if you need to affect many AEP files in a multi-threaded fashion for changing the source text of one layer. As far as I can tell, if I run AfterFX.exe with the -s flag, it starts up After Effects and runs the script specified with that flag. What happens when you want to run that script on, let’s say, 10 AEP files without having to wait for one to finish before moving onto the next. You can’t. The way it’s implemented, scripting is executed serially, not in parallel.

    Do you know if it is possible to write a command line program (much like aerender.exe) that can examine the AEP file and target a text layer’s properties? I checked out the SDK API, but it seems that the API is mainly for developers who want to write plugins (again, while AE is up and running).

    Thanks man, for all your time and advice.

    Best,
    Arie


    Arie Stavchansky | Demo Reel | Portfolio of Creative Work | Blog

  • Dan Ebberts

    April 28, 2011 at 2:41 pm

    Have you tried launching AE via command line with the -m as well as the -s (or -r) option? I haven’t tried it, but I think that might allow you to run multiple instances of AE at the same time.

    Dan

  • Arie Stavchansky

    April 28, 2011 at 2:44 pm

    Dan,

    Yes, the -m flag would work if only it didn’t take so much time and memory resources to launch AE. The reason AE takes so long for it load on my render station is that I have a great many effects installed. So just the loading of effects plugs takes a good while. Is there a way to launch AE with the -m flag and supress all of it’s bells and whistles? Kind of like a safe-mode launch state of AE?

    Thanks,
    Arie


    Arie Stavchansky | Demo Reel | Portfolio of Creative Work | Blog

Page 1 of 2

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