Creating a Non-Stretching Text Box with Fixed Width in Illustrator Scripting
I'm trying to create a text box with a script, so that the type area has a max width, and contents will auto line beak to fill the space. The plan is for a storyboard template generating tool, putting textboxes below each frame.
This script will create a text object, but setting the width will squsih/stretch the text content to the set width, not create a textbox at that width I can then fill.
I'm trying to get this to work like you simply clicked and draged out a type container, giving it a set width.
var textFrame = app.activeDocument.textFrames.add();
textFrame.kind = TextType.AREATEXT;
// Set the text contents
textFrame.contents = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
// Set the maximum width
textFrame.width = 200;
textFrame.top = -100;
textFrame.left = 100;
