Skip to main content
Participant
November 9, 2018
Answered

How to edit a text Master Property via ExtendScript?

  • November 9, 2018
  • 1 reply
  • 1481 views

Hi,

This seems basic, but I can't figure it out. I can't change the value of my text Master Property, via Extendscript. I tried treating the property the same way I would treat the Source Text property of a text layer, but After Effects doesn't like this.

var newText = new TextDocument("This is new text.");

var myLayer = myComp.layer("Title Text"); //This is my comp with the master properties.

var myLayer2 = myComp.layer("Text 1"); //This is my text layer.

var myProp = myLayer.masterProperty("Text");

var myProp2 = myLayer2.sourceText;

myProp2.setValue(newText); //This is changing the text of the text layer and works.

myProp.setValue(newText); //This is changing the text of the master property and doesn't work.

The error I get in Extendscript is "After Effects error: invalid text layer."

I would appreciate any help.

This topic has been closed for replies.
Correct answer zlovatt

It looks like there's a bug with text properties! I can't get or set values with text properties, but with all other property types it works just fine.

I've filed a bug about this (DVAAE-4208260).

1 reply

zlovatt
zlovattCorrect answer
Inspiring
November 12, 2018

It looks like there's a bug with text properties! I can't get or set values with text properties, but with all other property types it works just fine.

I've filed a bug about this (DVAAE-4208260).

Participant
November 13, 2018

Thanks for confirming that it's a bug. Hopefully it gets fixed.

For anyone else, I worked around it by adding an expression to the Text master property linking it to the layer name, then changing the layer name. That seems to work ok.

myLayer.masterProperty("Text").expression = "thisLayer.name";

myLayer.name = str;