Skip to main content
Participant
June 23, 2025
Answered

Trouble with using CSV for SourceText AND using style.setFontSize together

  • June 23, 2025
  • 1 reply
  • 330 views

I have a lot of text layers. I have two expressions working but they're not working together.

 

col = 0;

row = index - 1;

sl = thisComp.layer("CNTRL").effect("Text Size")("Slider");

txt = footage("Use Cases.csv").dataValue([col, row]);

text.sourceText.style.setFontSize(sl);

 

So, if this expression ends with the "style.setFontSize" command, then it ignores the text that it pulls from the CSV and defaults to the set sourcetext. But if it ends with "txt" then it pulls in the proper text from the CSV, but I have no control over the Font Size.

 

How can I get these two commands working together?

 

I've tried all sorts of rearranging. ChatGPT suggested this:

 

USC = text.sourceText instanceof TextDocument ? text.sourceText : new TextDocument("");

USC.text = txt;

USC = style.setFontSize(sl);

USC

 

but I don't know what it's referencing thinking that this is viable. The "instanceof" and "new" commands aren't something I've ever been aware of and they're definitely not working.

Correct answer Dan Ebberts

Try it this way:

col = 0;
row = index - 1;
sl = thisComp.layer("CNTRL").effect("Text Size")("Slider");
txt = footage("Use Cases.csv").dataValue([col, row]);
style.setFontSize(sl).setText(txt);

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
June 23, 2025

Try it this way:

col = 0;
row = index - 1;
sl = thisComp.layer("CNTRL").effect("Text Size")("Slider");
txt = footage("Use Cases.csv").dataValue([col, row]);
style.setFontSize(sl).setText(txt);
Participant
June 23, 2025

That did it! You're the best! So with the "style.set......" expressions, are you able to just build a long string of those together in no particular order, or is the sequence critical to it?

Dan Ebberts
Community Expert
Community Expert
June 23, 2025

Yes, you can string them together and I think the order isn't important, but I'm not 100% ceratin of that. If there are any rules as to the order, I'd love to know what they are...