Skip to main content
Inspiring
April 10, 2018
Question

boxText parameters not updating

  • April 10, 2018
  • 1 reply
  • 512 views

Hello,

I have problem with changing parameters for boxText.

I can manipulate Position and BoxTextSize, but fontSize doesn't change no matter what I write.

At the end of the script I put alert box, and when I check textDocument fontSize it gives me correct value,

but in Comp window, boxText is always the same size.

Here is code

(my text string is in variable s1Atxt1OK)

var ttPlac = app.project.item(5).layers.addBoxText([1050, 100]);

ttPlac.property("ADBE Transform Group").property("ADBE Position").setValue([880, 800]);

var textProp = ttPlac.property("Source Text");

var textDocument = textProp.value;

textDocument.resetCharStyle();

textDocument.resetParagraphStyle();

textDocument.fontSize = 100;

textDocument.fillColor = [1, 1, 1];

textDocument.font = "HelveticaNeueLTPro-BdCn";

textDocument.applyStroke = false;

textDocument.applyFill = true;

textDocument.text = s1Atxt1OK;

textDocument.justification = ParagraphJustification.LEFT_JUSTIFY;

textDocument.tracking = -10;

textProp.setValue(textDocument);

// checking with alert that font size is updated (because in comp window it doesn't change)

var box = textDocument.fontSize;

alert(box);

Thanks,

Goran

This topic has been closed for replies.

1 reply

girrosAuthor
Inspiring
April 10, 2018

After spending whole afternoon yesterday trying to solve this problem I found possible solution here:

Re: addBoxText() long creation time

Maybe it's a bug or some kind of undocumented mechanism (at least in CS6 scripting guide), but boxText property("Source Text") parameters will be changed if you type textProp.setValue(textDocument); TWICE at the end. Like this:

textProp.setValue(textDocument);

textProp.setValue(textDocument);

Now everything works.

Ilya217794162hc3
Participating Frequently
February 22, 2023

five years have passed, but this problem has still not been noticed by anyone. I also have to use textProp.setValue(TextDocument) twice, because I just can't change the font on the first try. My script handles hundreds of layers and this function has the longest execution in the entire code. In addition, you have to repeat it twice, which aggravates the situation