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

Expression to Change one line of a text layer

Community Beginner ,
Mar 07, 2025 Mar 07, 2025

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

TOPICS
Expressions
83
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
Adobe Employee ,
Mar 07, 2025 Mar 07, 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.

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 ,
Mar 07, 2025 Mar 07, 2025
LATEST

Thank You! I will give that a try

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