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

"donor text" affects all attributes of "clone" tags, not just content. How to do it?

New Here ,
May 10, 2025 May 10, 2025

Good day. I apologize if I am writing in the wrong thread, I am in despair, I can not solve the problem:

I need to Create a Control Text Layer (donor text), and bind another layer with text to it, so that any changes in (donor text) would affect all other bound layers with text.

The expression "thisComp.layer("donor text").text.sourceText" only changes the content of the text! But the style, font and other attributes are not transferred to the bound layers!!!

The option from the GPT chat does not work either:

srcDoc = thisComp.layer("donor text").text.sourceText;
dstDoc = createTextDocument(srcDoc.text); // clone with the same text
------------------------------------
// transfer the main styles
dstDoc.font = srcDoc.font;
dstDoc.fontSize = srcDoc.fontSize;
dstDoc.applyFill = srcDoc.applyFill;
dstDoc.fillColor = srcDoc.fillColor;
dstDoc.applyStroke = srcDoc.applyStroke;
dstDoc.strokeColor = srcDoc.strokeColor;
dstDoc.strokeWidth = srcDoc.strokeWidth;
dstDoc.leading = srcDoc.leading;
dstDoc.tracking = srcDoc.tracking;
dstDoc.justification = srcDoc.justification;

dstDoc; // must return an object
------------------------------------

What am I doing wrong? Where is the error?

the condition for setting up the project is met:
A. Setting up the project
File → Project Settings → Expressions
Expression Engine = JavaScript (important!)
Click OK, save the project, close AE and open it again.

B. Global setting Preferences
Edit → Preferences → Scripting & Expressions
▢ Enable Legacy Extendscript Expressions (must be unchecked!)
☑ Enable JavaScript based Expressions

---------------------------
Please help. Thank you.

TOPICS
Expressions
187
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 , May 10, 2025 May 10, 2025

I think all you need to pick up the donor text layer's style and text would would an expression like this:

txt = thisComp.layer("donor text").text.sourceText;
donorStyle = txt.style;
donorStyle.setText(txt)
Translate
Community Expert ,
May 10, 2025 May 10, 2025

I think all you need to pick up the donor text layer's style and text would would an expression like this:

txt = thisComp.layer("donor text").text.sourceText;
donorStyle = txt.style;
donorStyle.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
New Here ,
May 10, 2025 May 10, 2025
LATEST

Hurray!! Thank you very much, health and prosperity to you.   for a whole day I suffered with the vaunted GPT-4o, but as it turned out, it was more effective and faster to ask an Experienced person :)))

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