Copy link to clipboard
Copied
Hey,
Well, I don't see why double clicking on the handles wouldn't work. Any of them do work for me.
If they don't for some reasons, you could indeed bypass the bug with a script.
What you basically do is activating/ deactivating the autofit option on the selected textframe, using the settings your prefer. In the meantime, there is already something canon in ID for modifying the options of the selected texframe (right-click, Text frame option / CMd+B). Not sure a script is relevant here.
Anyways, t
...Copy link to clipboard
Copied
Hey,
Well, I don't see why double clicking on the handles wouldn't work. Any of them do work for me.
If they don't for some reasons, you could indeed bypass the bug with a script.
What you basically do is activating/ deactivating the autofit option on the selected textframe, using the settings your prefer. In the meantime, there is already something canon in ID for modifying the options of the selected texframe (right-click, Text frame option / CMd+B). Not sure a script is relevant here.
Anyways, the code could be then something like that :
var selectedItem = app.selection[0];
selectedItem.textFramePreferences.autoSizingType = AutoSizingTypeEnum.WIDTH_ONLY;
selectedItem.textFramePreferences.autoSizingReferencePoint = AutoSizingReferenceEnum.LEFT_CENTER_POINT;
selectedItem.textFramePreferences.autoSizingType = AutoSizingTypeEnum.OFF;
If the purpose of the script is to adjust the width of every textframe of the active document, then, a script would obviously not be an option, but pretty much mandatory if you want to really save some time. Just making a loop on all the textframes of the document will do
Copy link to clipboard
Copied
Hi @Fred.L
Thank you very much.
Double-clicking the handle works.
It seems the left side jumped a bit—can you keep it stationary?
Did it contract toward the center?
Changing it to TOP_LEFT_POINT still seems to center it.
This line seems ineffective:
selectedItem.textFramePreferences.autoSizingReferencePoint = AutoSizingReferenceEnum.BOTTOM_LEFT_POINT;
Removing it makes no difference.
Copy link to clipboard
Copied
Hi @dublove ,
assign both property/value pairs at the same time like that:
var selectedItem = app.selection[0];
selectedItem.textFramePreferences.properties =
{
autoSizingType : AutoSizingTypeEnum.WIDTH_ONLY ,
autoSizingReferencePoint : AutoSizingReferenceEnum.LEFT_CENTER_POINT
};
Or change the order of assigning the values like that:
var selectedItem = app.selection[0];
selectedItem.textFramePreferences.autoSizingReferencePoint = AutoSizingReferenceEnum.LEFT_CENTER_POINT;
selectedItem.textFramePreferences.autoSizingType = AutoSizingTypeEnum.WIDTH_ONLY;
Kind regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
Hi @Laubender
Thank you very much.
That's a good idea. I'll ditch HEIGHT_AND_WIDTH and just adjust the WIDTH_ONLY, then use fit(FitOptions.FRAME_TO_CONTENT).
Copy link to clipboard
Copied
I think I know how to proceed now. Thank you very much.
Copy link to clipboard
Copied
@dublove said: "… How can I identify and avoid applying it to these cases?"
Well, one text frame contains a single line of text without a table, the other one contains multiple lines of text without a table and the 3rd sample contains a table only.
The if statements for the 3 cases could contain:
myTextFrame.texts[0].lines.length == 1
&&
myTextFrame.texts[0].tables.length == 0
myTextFrame.texts[0].lines.length > 1
&&
myTextFrame.texts[0].tables.length == 0
myTextFrame.texts[0].lines.length == 1
&&
myTextFrame.texts[0].tables.length == 1
Kind regards,
Uwe Laubender
( Adobe Community Expert )
Find more inspiration, events, and resources on the new Adobe Community
Explore Now