Expression to Change one line of a text layer
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thank You! I will give that a try

