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

boxText parameters not updating

Community Beginner ,
Apr 10, 2018 Apr 10, 2018

Copy link to clipboard

Copied

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

TOPICS
Scripting

Views

359

Translate

Translate

Report

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 ,
Apr 10, 2018 Apr 10, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
Explorer ,
Feb 22, 2023 Feb 22, 2023

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

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