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!
set height of text path of textFrame to CH * 1.5
Copy link to clipboard
Copied
In JavaScript, but could be ported to AppleScript:
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
Copy link to clipboard
Copied
set height of text path of textFrame to CH * 1.5
Copy link to clipboard
Copied
Exactly what I needed! Thanks!
Now, I'll try to adapt the javascript code
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.
Copy link to clipboard
Copied
Just found out:
set number_of_lines to count every line of textFrame