Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Control both source text and text style through separate expressions

Community Beginner ,
Jul 08, 2025 Jul 08, 2025

I need to create a template composition with a text box that has both its text content and text styling controlled through two different expressions. Ultimately, I need to make multiple versions of the same comp where both text source and style can be changed with the essential graphics panel. The issue that I'm running into is that the new text expressions seem like they can control either styling or content, but not both - whatever bit of code I write into the expression undoes what I had done previously. For example, if I were to write...

text.sourceText.content = "Adjusted Text"

text.sourceText.style
	.setFontSize(thisComp.layer("effectsSliders").effect("FontSize")("Slider"))
	.setFont("arial")

 ...then I would get the styling that I want, but I wouldn't be able to change the content. If I were to re-arrange the code to look like this... 

text.sourceText.style
	.setFontSize(thisComp.layer("effectsSliders").effect("FontSize")("Slider"))
	.setFont("arial")
	
text.sourceText.content = "Adjusted Text"

...then I would be able to control the source text, but not the styling.

 

I've looked through the resources that Adobe has posted, but I don't see anything that would allow me to do what I need to do. Does anyone know how to control both the content and the style of a text layer with two different expressions?

 

Any help would be appreciated

TOPICS
Expressions
124
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 08, 2025 Jul 08, 2025

Try it this way:

txt = "Adjusted Text";
text.sourceText.style
    .setFontSize(thisComp.layer("effectsSliders").effect("FontSize")("Slider"))
    .setFont("Arial")
    .setText(txt)
Translate
Community Expert ,
Jul 08, 2025 Jul 08, 2025

Try it this way:

txt = "Adjusted Text";
text.sourceText.style
    .setFontSize(thisComp.layer("effectsSliders").effect("FontSize")("Slider"))
    .setFont("Arial")
    .setText(txt)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 09, 2025 Jul 09, 2025
LATEST

That did it! Thank you for your quick and simple reply, and thank you for saving my career for the past decade 🙂

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines