Skip to main content
Eaglescience
Participant
September 21, 2021
Answered

Vertical alignment scripting

  • September 21, 2021
  • 3 replies
  • 1548 views

In Illustrator we have the option to vertically align text via Area Type, which is a great addition. However, I would like to use this feature through scripting. Can anyone tell me if this is available (cannot find it in the docs) and if so, how to use it? I'd imagine it to look something like this:

 

textRef.AreaType = Align.CENTER

 

This topic has been closed for replies.
Correct answer CarlosCanto

Text Align Center can be recorded, so do that, then have your script run the Action (or use standalone)

3 replies

ajabon grinsmith
Community Expert
Community Expert
September 22, 2021

Is that it? 

app.selection[0].textRange.characterAttributes.alignment = StyleRunAlignmentType.center;
Eaglescience
Participant
September 22, 2021

Unfortunately this doesn't vertically align the text

CarlosCanto
Community Expert
CarlosCantoCommunity ExpertCorrect answer
Community Expert
September 22, 2021

Text Align Center can be recorded, so do that, then have your script run the Action (or use standalone)

pixxxelschubser
Community Expert
Community Expert
September 21, 2021

I don't think this is possible in the way you want. Unfortunately, with scripts we don't have access to the alignment options for text frames.

femkeblanco
Legend
September 21, 2021

This works for both point and area text:

// select textFrame
var text1 = app.selection[0];
text1.textRange.paragraphAttributes.justification = Justification.CENTER;

 

Edit:  I misread what you wrote.