-
Pulling text from a .txt file
Hi everyone
Relatively new to creating expressions After Effects expressions, but not new to After Effects.
I’ve coded a program that generates a .txt file. I’ve done this because manually typing text between ” and ” is fiddly and annoying in NotePad. The result is something like this (including the spaces between each batch for easier reading:
IMAGE1 = “Text here”
DESC1 = “Smaller text here”IMAGE2 = “Text here”
DESC2 = “Smaller text here”IMAGE3 = “Text here”
DESC3 = “Smaller text here”and so on, up to “IMAGE20” and “DESC20”.
The generated document is called “sourcetext.txt” and is saved in the same folder as the After Effects project.
Within the After Effects project there are 20 compositions containing text. Each one has an expression such as:
$.evalFile(“\sourcetext.txt”);
eval(“IMAGE1”);which displays the text from the relevant line within the txt document.
By default, I get an error message that says “Error occurred at line 1. Comp: ‘text_1’, etc.
Is there anything wrong with what I’m doing? Please help! If it helps, I’m using the CS6 version of AFX.
IMAGE3 = "Text here"
DESC3 = "Smaller text here"$.evalFile("\sourcetext.txt");
eval("IMAGE1");