Illustrator Version CS3-CC
Preferred scripting: Visual Basic (VBScript)
In the Adobe Illustrator CS5 Scripting Reference (VBScript), I see the following code for setting character attributes.
iCount = textRef.Characters.Count
i = 1
Do While (i < (iCount + 1))
dSize = dSize * 1.1
textRef.TextRange.Characters(i).CharacterAttributes.HorizontalScale = dSize
textRef.TextRange.Characters(i).CharacterAttributes.VerticalScale = dSize
i = i + 1
Is there a way to set character attributes on a range of characters at once?
Iterating through the characters one by one is really slow, especially in higher versions of Illustrator (like CS6).
I want to be able to set character attributes, for example, from the third character to the sixth character of a paragraph textrange.
Basically, I want to do something like itembyrange in InDesign scripting.
lets change the 2nd, 3rd and 4th characters at once
first, define the 2nd character as your initial range
Set irange = textRef.Characters(2)
then, increase the range size to include characters 3 and 4
irange.Length = 3
finally, change the range attributes
irange.CharacterAttributes.HorizontalScale = 200
Thanks a million! Now my script runs fast even when there are a lot of characters that I need to change.