Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Vertical alignment scripting

New Here ,
Sep 21, 2021 Sep 21, 2021

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

 

TOPICS
Scripting
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Sep 21, 2021 Sep 21, 2021

alignment_text.pngexpand image

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.

Translate
Community Expert , Sep 22, 2021 Sep 22, 2021

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

Translate
Adobe
Guide ,
Sep 21, 2021 Sep 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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2021 Sep 21, 2021

alignment_text.pngexpand image

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2021 Sep 21, 2021

Is that it? 

app.selection[0].textRange.characterAttributes.alignment = StyleRunAlignmentType.center;
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 22, 2021 Sep 22, 2021

Unfortunately this doesn't vertically align the text

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 22, 2021 Sep 22, 2021
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines