Reputation: 315
I'd like to change the typeface for the currently selected text elements.
Here is the code I've tried:
var sel = app.activeDocument.selection;
for (i = 0 ; i<sel.length ; i++)
{
sel[i].textRange.characterAttributes.textFont = textFonts.getByName("Arial");
}
Here's the error I'm getting:
Error 1302: No such element
-> sel[i].textRange.characterAttributes.textFont = textFonts.getByName("Arial");
How can I get to the textFont element of the selection? Thanks!
Upvotes: 0
Views: 1070
Reputation: 315
OK it turns out if you don't have the exact font name it will throw the error. In this case, the font name is "ArialMT". It works now.
Upvotes: 1