Skip to main content
Brandon_Roots
Participating Frequently
June 15, 2014
Question

How to change font via ExtendScript

  • June 15, 2014
  • 1 reply
  • 2720 views

Alright, there is probably a simple solution here, but I can't seem to change the font for a layer via ExtendScript. The CS6 scripting guide has me trying the following code:

var textProp = app.project.activeItem.layer(1).property("Source Text");

var textDocument = textProp.value;

textDocument.font = "TimesNewRomanPSMT";

Which I guess could also be written as:

app.project.activeItem.layer(1).property("Source Text").value.font = "TimesNewRomanPSMT";

The code executes without errors but the font in that layers remains with the previous setting.

Any ideas?

This topic has been closed for replies.

1 reply

Inspiring
June 15, 2014

No, it can't be written that other way.

var textProp = app.project.activeItem.layer(1).property("Source Text");

var textDocument = textProp.value;

textDocument.font = "TimesNewRomanPSMT";

textProp.setValue(textDocument);

Brandon_Roots
Participating Frequently
June 15, 2014

Thank you for your help Paul. Looks like I misread the Scripting Guide and didn't catch

textProp.setValue(textDocument);