Skip to main content
Inspiring
July 31, 2014
Question

Change font size of a text item in illustrator extendscript and oth attributes

  • July 31, 2014
  • 1 reply
  • 1408 views

I have a series of text items on a page, some of them are grouped. I would like to go through theses grouped items and set the point size of the type to 8 point. I've don this

    for (var i = 0; i < layer.groupItems.length; i++) {

        var group=layer.groupItems;

        $.writeln("Group iyem=",group);

        for (var k = 0; k< group.textFrames.length;k++) {

            item=group.textFrames;

            $.writeln("Text item ",item.name);

            $.writeln("Text item ",item.size=8);

            };

        };

...but it doesn't work. If I change the line

   $.writeln("Text item ",item.size=8)

to

   $.writeln("Text item ",item.content)

it returns the text string correctly so I'm pretty confident that I'm accessing the correct item on the page. But I can't access/change the size of the type, or indeed any of the type attributes. What am I doing wrong? Tried to find some reference for this but struggling. Using CS5 by the way

Thanks

This topic has been closed for replies.

1 reply

Inspiring
July 31, 2014

Worked it out, it should be

    $.writeln("Text item ",item.textRange.characterAttributes.size);

Bit long winded but got there