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

Select text boxes with overset text

Explorer ,
Nov 24, 2023 Nov 24, 2023

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 

TOPICS
Scripting

Views

209

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

Community Expert , Nov 24, 2023 Nov 24, 2023

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
...

Votes

Translate

Translate
Community Expert ,
Nov 24, 2023 Nov 24, 2023

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... 

 

▒► ID-Tasker / ID-Tasker Server - work smart not hard ◄▒

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
Explorer ,
Nov 24, 2023 Nov 24, 2023

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

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
Community Expert ,
Nov 24, 2023 Nov 24, 2023

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?

 

▒► ID-Tasker / ID-Tasker Server - work smart not hard ◄▒

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
Explorer ,
Nov 24, 2023 Nov 24, 2023

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:

Danilo243268172lwz_1-1700824140038.png

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

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
Community Expert ,
Nov 24, 2023 Nov 24, 2023

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. 

 

▒► ID-Tasker / ID-Tasker Server - work smart not hard ◄▒

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
Community Expert ,
Nov 24, 2023 Nov 24, 2023

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)
}

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
Explorer ,
Nov 24, 2023 Nov 24, 2023

Copy link to clipboard

Copied

LATEST

Hi Peter,

Thank you so much! It works perfectly!

Best regards

Danilo

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