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

fit frame to text automatically with AppleScript

Participant ,
Aug 24, 2017 Aug 24, 2017

Copy link to clipboard

Copied

Hi!

I have a script that replace text frame content with new text, however sometimes, the text is longer than the text frame causing the text to be hidden.

I saw that there is something like this for InDesign, but this doesn't work for Illustrator:

  tell textFrame to fit given frame to content

  end tell

Is there something similar available for Illustrator on AppleScript?


Note: I also saw the option with: Type > Area Type Options > Auto Size

Thanks!

TOPICS
Scripting

Views

1.4K

Translate

Translate

Report

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

Engaged , Aug 28, 2017 Aug 28, 2017

set height of text path of textFrame to CH * 1.5

Votes

Translate

Translate
Adobe
Engaged ,
Aug 25, 2017 Aug 25, 2017

Copy link to clipboard

Copied

In JavaScript, but could be ported to AppleScript:

fit frame to text (free script)

Votes

Translate

Translate

Report

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
Participant ,
Aug 28, 2017 Aug 28, 2017

Copy link to clipboard

Copied

Hi!

I've tried but when expanding the height of my text frame, its expanding the text as well.. Not sure why, even when I reset the text font and size..

It looks like its corresponding to the action of when you expand manually the text box on illustrator but it expands the text as well (text being higher.. or larger if you expand the width). And to expand just the text box without expanding the text, you have to double click again on the text box. I don't know if you see what I mean..

What I tried is: (textFrame being the current textFrame)

    set CH to the height of textFrame

    set height of textFrame to CH * 1.5

Votes

Translate

Translate

Report

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
Engaged ,
Aug 28, 2017 Aug 28, 2017

Copy link to clipboard

Copied

set height of text path of textFrame to CH * 1.5

Votes

Translate

Translate

Report

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
Participant ,
Aug 28, 2017 Aug 28, 2017

Copy link to clipboard

Copied

Exactly what I needed! Thanks!

Now, I'll try to adapt the javascript code

Votes

Translate

Translate

Report

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
Participant ,
Aug 28, 2017 Aug 28, 2017

Copy link to clipboard

Copied

Do you know how to get the number of lines in the text box? I saw the row count property in the applescript library, but I can't get it to work.

Votes

Translate

Translate

Report

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
Participant ,
Aug 28, 2017 Aug 28, 2017

Copy link to clipboard

Copied

LATEST

Just found out:

     set number_of_lines to count every line of textFrame

Votes

Translate

Translate

Report

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