Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Reading a txt file

  • Reading a txt file

    Posted by Frank Lima on June 12, 2012 at 2:04 am

    I am using Expressions to read in an external txt file into a text layer. How would I just be able to read the contents of a txt file into the text layer’s ‘source text’ attribute?

    Frank Lima replied 14 years, 1 month ago 42,914 Members · 1 Reply
  • 1 Reply
  • Frank Lima

    June 12, 2012 at 6:38 pm

    I have this piece of code here but it makes a comparison and all I want it to do is just read the contents of the txt file:

    try
    {
    //If Apple OS X, then use this directory format
    if ($.os.indexOf("Mac") != -1)
    {
    myPath = "/directory/";
    }
    //If using Windows XP and above, use this directory format
    else
    {
    myPath = "file://c:\\directory\";
    }

    //Must use dynamic name allocation in relation to after effects name, using data.txt as a temporary placeholder
    myPath += "data.txt";

    //COMPARISON DONE HERE, JUST WANT TO READ CONTENTS OF THE TXT FILE
    $.evalFile (myPath);
    eval(thisComp.name);
    }

    //Catch and display error if no file is found
    catch(err)
    {
    "File Not Found";
    }

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