Copy link to clipboard
Copied
Hello,
I was trying to think in a script where is possible to select all text boxes with overset text inside a page and/or in the whole document.
I see there is textFrame.overflows possibility in the script but this only returns true or false. I can't think how to return the boolean in concrete itens.
Any thoughts?
Thank you
Danilo
As Robert pointed out, you can select frames only on a single page or spread, so you need two scripts: one to select overset frames on a page and another to apply autosizing to all overset text frames in a document:
// Set Autosizing on overset frames
frames = app.documents[0].textFrames.everyItem().getElements();
for (i = 0; i < frames.length; i++) {
if (frames[i].overflows) {
frames[i].textFramePreferences.properties = {
autoSizingReferencePoint: AutoSizingReferenceEnum.TOP_CENT
...
Copy link to clipboard
Copied
Boolean have two values - True or False.
You can select - manually or from script - ONLY items on the same page / spread - you can't on different spreads.
Unless you would use my tool - but it's PC only...
Copy link to clipboard
Copied
Hi Robert,
In the case for the whole document, I would like to transform and auto adjust the height only in the top of the text box.
In the case for the page, I would like to select them.
I have Mac, I think the tool won't work then.
Sorry for the confusion.
Best regards
Copy link to clipboard
Copied
I'm not JS guy - but can you specify what do you mean by "auto adjust the height only in the top of the text box"? Top margin? Or the overall height of the TextFrame?
Copy link to clipboard
Copied
Hi Robert,
I mean apply the auto size taking the reference point the top center one in the text box:
This is what I would like to apply in the whole document for those text boxes.
For those in the page, I would like only to select them and do other tasks.
Best regards
Danilo
Copy link to clipboard
Copied
OK, do ALL TextFrames are the same? If YES - then you should rather apply ObjectStyle - then you can control all of them at once.
If not - then use multiple ObjectStyles.
Copy link to clipboard
Copied
As Robert pointed out, you can select frames only on a single page or spread, so you need two scripts: one to select overset frames on a page and another to apply autosizing to all overset text frames in a document:
// Set Autosizing on overset frames
frames = app.documents[0].textFrames.everyItem().getElements();
for (i = 0; i < frames.length; i++) {
if (frames[i].overflows) {
frames[i].textFramePreferences.properties = {
autoSizingReferencePoint: AutoSizingReferenceEnum.TOP_CENTER_POINT,
autoSizingType: AutoSizingTypeEnum.HEIGHT_ONLY,
}
}
}
// Select overset frames on a page
overset = [];
frames = app.windows[0].activePage.textFrames.everyItem().getElements();
for (i = 0; i < frames.length; i++) {
if (frames[i].overflows) {
overset.push (frames[i]);
}
}
if (overset.length > 0) {
app.select (overset)
}
Copy link to clipboard
Copied
Hi Peter,
Thank you so much! It works perfectly!
Best regards
Danilo