Skip to main content
Participant
Jun 23, 2025 6:57 PM UTC
Answered

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

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.

Dan Ebberts
Dan EbbertsCorrect answer
Community Expert
Jun 23, 2025 8:59 PM UTC

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);

4 replies

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
Jun 23, 2025 8:59 PM UTC

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);
Translate
Participant
Jun 23, 2025 9:30 PM UTC

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?

Translate
Dan Ebberts
Community Expert
Community Expert
Jun 23, 2025 9:36 PM UTC

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...

Translate