enter image description here enter image description here enter image description here

Hi, I am new to illustrator and I want to align the textFrame centered to the pathItem(square) using Extendscript as shown in picture1. I have uploaded another picture, which shows the layer and group of these objects. Actually, all these squares and textFrames in one group. let me know how can i want to align them horizontally centered according to each other.

I want to align this green square and textFrame(TEST)'s midpoints horizontally.

Thanks in advance!

  • Possibly helpful: helpx.adobe.com/illustrator/using/align-text.html
    – Scott
    Dec 6, 2020 at 23:47
  • i require the function name or code snippet for alignment, but thanks for the help.:)
    – dextoruz
    Dec 7, 2020 at 0:26
  • Okay.. then check the AI scripting guide pdf
    – Scott
    Dec 7, 2020 at 0:45
  • I have already go through it but nothing found related to my work. i appreciate your concern but it is not what i require. I require Vertical center Alignment code snippet or function in Extendscript.
    – dextoruz
    Dec 7, 2020 at 12:59
  • This is probably better asked of Adobe if the scripting guide is insufficient.
    – Scott
    Dec 8, 2020 at 18:44

1 Answer 1


It can be done by mathematically: y-axis - (textFrameHeigth / 2 - squareHeight / 2). And y-axis is the position of the square(pathItem) and textFrame on the artboard which would same because of center alignment. You can get square and textFrame height by using app.document.square.height or (pathItem.height) and app.document.textFrames[x].height.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.