Skip to main content
Participating Frequently
March 7, 2025
Question

Expression to Change one line of a text layer

  • March 7, 2025
  • 1 reply
  • 261 views

I'm creating a MOGRT for a graphic that has a bunch of copyright and legal copy on the bottom. I need to enable it so that editors can change just a portion of one of the lines

 

"© 2025 XYZ Corp. All Rights Reserved. YYY-ZZ-XXXXX"

 

I need the editors to be able to change the YYY-ZZ-XXXXX part. What I've been doing is just having two text layers, one with the non-changeable line and one with the editable line and just putting the source text of the editable line in the MOGRT. It works but sometimes the length of the second line is longer or shorter and I added a position property so the editor can nudge it into the right place. I feel like it could be cleaner/simpler.

So I'm wondering if there is a sourceText expression that will allow for changing just the YYY-ZZ-XXXX part if everything is on one text layer

1 reply

Theresa Rostek
Community Manager
Community Manager
March 7, 2025

Hi @J_A_Willi327,

You'll create two text layers; 1 as the Input Text, and 1 as the Visual Text. Add your Input Text's source text to the EGP. Hide this layer.

Then on your Visual Text layer, enable expressions and add the following:

var inputText = thisComp.layer("Input Text").text.sourceText;
var inputStyle = inputText.style;
inputStyle.setText("© 2025 XYZ Corp. All Rights Reserved. " + inputText )

 

To change the font size, font, faux styles, etc., change the Input Text or you can enable Font Properties in the EGP if it makes sense to have those controls in the mogrt.

Motion Graphics, Premiere Pro
Participating Frequently
March 7, 2025

Thank You! I will give that a try