Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions CS4 Source text load from external .txt file

  • CS4 Source text load from external .txt file

    Posted by Chad Dankert on July 1, 2009 at 3:34 pm

    I have been using the following source text expression in my CS3 projects to load text dynamically for lower thirds and titles:

    #include’/media/text.txt’

    try{
    eval(thisComp.name)
    }
    catch(err){“not found”}

    The external .txt file is formatted as follows:

    L3_01 = “FirstName LastName”

    L3_02 = “FirstName LastName”
    ;

    And the comps in the AE file match those in the text file accordingly.

    I just recently upgraded to CS4 and the expression no longer works. Any help on loading text dynamically in After Effects CS4 would be greatly appreciated.

    Thanks in advance.

    cd

    Nico Mähler replied 16 years, 4 months ago 5 Members · 8 Replies
  • 8 Replies
  • Dan Ebberts

    July 1, 2009 at 4:54 pm

    Try this:

    myPath = “/media/text.txt”;
    try{
    $.evalFile (myPath);
    eval(thisComp.name);
    }catch (err){
    “not found”
    }

    Dan

  • Chad Dankert

    July 2, 2009 at 2:02 pm

    Thanks Dan. That works perfectly.

    Next question, is it possible to cut the path in the expression down to the relative path to the AE project? Currently I’m having to use the absolute path…

    Thanks again.

    chad

  • Pierre-alexis Tremblay

    July 2, 2009 at 4:08 pm

    Would it be possible to get an expression from an external text file as well?

    P.A.T.

  • Dan Ebberts

    July 2, 2009 at 5:22 pm

    Actually that’s what you’re doing — putting part of the expression code in a text file. You could certainly put it all in there.

    Dan

  • Dan Ebberts

    July 2, 2009 at 5:46 pm

    I can’t think of a good way to do that. A script can get at the path to the project, but I don’t think an expression can.

    Dan

  • Lu Nelson

    December 21, 2009 at 10:55 am

    Dan,

    do you know of a way to force a composition expression to reload the external file? I notice that if I make and save changes in an external file the changes don’t update unless I switch the layer’s visibility on or off, or toggle the “=” sign next to the expression, or close and re-open the project. I’m using this technique for a bunch of lower 3rds so it’d be nice if there was a quick way to force them all to reload…

    Lu Nelson
    Berlin, Germany

    [MacProQ2.66, 8GB, Sys10.5.6, FCP 6.0.5, AE 9.0.2]

  • Dan Ebberts

    December 21, 2009 at 3:26 pm

    Yeah, I suspect that you have to do something that invalidates the cache and causes the expression to run again. Edit>Purge>Image Caches should do it, but I don’t know that that is any simpler than what you’ve been doing.

    Dan

  • Nico Mähler

    January 13, 2010 at 10:43 pm

    Hello,

    I used the script under Windows xp and it worked fine.
    But now I switched to Windows Vista and the script no longer work.
    After Effect reports that it couldn’t find the file or the folder, but the path is definitely the correct.

    Is it possible to bring the script to run?

    Thank you.

    nico

    $.evalFile("C:/myfile.txt");
    eval(thisLayer.name);

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