ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Scripting: Unable to change text properties via scripting

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Guillermo Sevillano
Scripting: Unable to change text properties via scripting
on Oct 1, 2019 at 7:15:06 am

Hello,

I'm trying to create a textbox via scripting with specific font, fontsize, text, etc... The code below is working as it is creating the textbox with the correct text string but it does omit fontSize and font, they do not change although the alert dialog show correct values.

What am I missing here? I feel it's just in front of my face but I can't figure it out.

Thanks in advance.

Guillermo

var comp = app.project.activeItem;

var title = comp.layers.addBoxText([250,250],"")
title_prop = title.property("ADBE Text Properties").property("ADBE Text Document");

title_text = title_prop.value;
title_text.fontSize = 500;
title_text.text = "Hello";
title_text.font = "ArialMT";

title_prop.setValue(title_text);
alert(title_text.font + " / " + title_text.fontStyle + " / " + title_text.fontSize);


Return to posts index

Guillermo Sevillano
Re: Scripting: Unable to change text properties via scripting
on Oct 1, 2019 at 8:12:37 am

Okay, I finally figured out what was the problem.

Apparently you need to set an initial text string value for the addBoxText options, it can't be null. So I resolved the issue by changing "" with "This is a test" or whatever string you want when creating the textBox.

Case closed

var title = comp.layers.addBoxText([250,250], "This is a test");


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]