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

Create textFrame along side Rectangle

New Here ,
Jul 18, 2013 Jul 18, 2013

Hi all,

I'm JavaScript, struggling with the creation of a textFrame along side a Rectangle. I can create the textFrame simply, set its content, and its auto-sizing, but I'm trying to position it's left-center anchor to the right-center anchor of an adjacent Rectangle. For the life of me, I can't seem to get it to work.

I suspect I need to use the resolve() method on the Rectangle to get its location, and then use that when setting the textFrame's geometricBounds, but it keeps appearing far off the page.

Any insights or examples of how this could be done would be welcomed greatly!

Cheers,

Lach

TOPICS
Scripting
867
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 1 Correct answer

Mentor , Jul 19, 2013 Jul 19, 2013

Hi,

I think there is no 1-line code solution.

I suggest to calculate a textFrame geometricBounds regarding to rectangle geometricBounds and create it with [y,x,Y,X] or move existing one to [x,y].

So it looks like mathematic effort.

Jarek

Translate
Mentor ,
Jul 19, 2013 Jul 19, 2013

Hi,

I think there is no 1-line code solution.

I suggest to calculate a textFrame geometricBounds regarding to rectangle geometricBounds and create it with [y,x,Y,X] or move existing one to [x,y].

So it looks like mathematic effort.

Jarek

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 ,
Jul 22, 2013 Jul 22, 2013
LATEST

Yeap, using the rectangle's geometricBounds as the base for the new textFrame's geometricBounds did the trick. Thanks!

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
Explorer ,
Jul 22, 2013 Jul 22, 2013

Hello,

maybe this script will be helpful (at least some its parts ) :

https://sites.google.com/site/dtpscripting/indesign-scripts/makerectangle-jsx

There are options Size > Selection and Content > Text, so you can select the rectangle you need and use the script. Or you can take some functions or blocks of the one. Unfortunately, all the comments there are in Russian

Best wishes,

Sergey

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