Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Editable text from CSV

  • Editable text from CSV

    Posted by Matt Howarth on March 31, 2022 at 10:51 am

    hi all,

    I’m trying to control numerous layers of text in a comp with the data from a CSV file. I have it working well, but the CSV file takes over completely, not allowing me to edit the text except from within the CSV file. I would ideally want to be able to “freeze” the text (to be no longer controlled by the CSV file) and have the formatting (including new line/carriage returns) that is already set up in AE be respected and the text to then be editable, for fine tuning.

    any thoughts welcome

    cheers

    Matt

    Matt Howarth replied 4 years, 1 month ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    March 31, 2022 at 9:54 pm

    The only thing I can think of would be to use a script to either apply the text from the CSV (instead of using and expression), or to run after you have everything set up and have the script harvest the CSV-generated text and apply it directly to the source text property (and turn off the exrpession). Don’t know if using a script fits your workflow though…

  • Matt Howarth

    April 1, 2022 at 7:25 am

    Hi Dan, thanks for responding again. Yes I was already thinking that a script would be the way to go. I have never made a script for AE yet, but I was thinking this would be a good place to start. It’s the applying or harvesting of the text that I don’t know how to do and also getting it to ignore the formatting in the CSV file. By that I really mean the “new line” and paragraph alignment information, it’s seems to leave the character information alone (font and spacing). Thanks again.

  • Dan Ebberts

    April 1, 2022 at 7:23 pm

    This is just a snippet to get you started. It assumes that your comp is active and the text layer is named “Text Layer 1”:

    var myTextLayer = app.project.activeItem.layer("Text Layer 1");

    var mySourceText = myTextLayer.property("ADBE Text Properties").property("ADBE Text Document");

    var myTextDoc = mySourceText.value;

    var myText = myTextDoc.text;

    myText = myText.replace(/\r?\n|\r/g, ' '); // replace new lines with spaces

    mySourceText.expressionEnabled = false;

    myTextDoc.text = myText;

    mySourceText.setValue(myTextDoc)

  • Matt Howarth

    April 2, 2022 at 8:14 am

    Dan, you are a star once again, thank you! : )

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