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

Is there a script that it can make Overflow text automatically routed Next?(Not the main text frame)

Guide ,
Mar 26, 2014 Mar 26, 2014

Is there a script that it can make Overflow text automatically routed Next?(Not the main text frame)

when I run the scrip,Overflow text can auto Typesetting to the next page?

thankS Supreme~

ov text.jpg

TOPICS
Scripting
1.4K
Translate
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
New Here ,
Mar 28, 2014 Mar 28, 2014

The code below checks the frames with excess per page and the id of the frame.

var myDoc = app.documents[0];

var myPages = myDoc.pages;

for (var i = 0; i < myPages.length; i++) {

    var myPage = myDoc.pages.item(i) ;

    var myFrame= myPage.textFrames;

    for (var m = 0; m < myFrame.length; m++) {

        if ( myFrame.item(m).overflows ) {

            alert("Overflow TextFrame ID: " + myFrame.item(m).id + "\npage: " + myPage.name );

        }   

    };

};

Translate
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
Guide ,
Mar 29, 2014 Mar 29, 2014

Hi  Luis Fernando Brito,thank you for Positiving reply.

But this is not my I I need,It  Should be able to Typesetting to the next page

Translate
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
Engaged ,
Apr 07, 2014 Apr 07, 2014

Have you looked into the feature "Smart Text Reflow" in the preferences panel ?

Thanks Stefan

Translate
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
Advocate ,
Apr 07, 2014 Apr 07, 2014

Here's the script I use. Notice the complications getting the live area when other than rulers per spread is employed. The script automatically selects the final selection point in the story and moves to that page in the active window.

//DESCRIPTION: Autoflow selected overset story

(function(){

          if (app.documents.length > 0

                              && app.selection.length == 1

                              && app.selection[0].hasOwnProperty("parentStory")

                              && app.selection[0].parentStory.overflows) {

                    app.doScript(fixOverset, undefined, app.selection[0].parentStory, UndoModes.entireScript, "Fix Overset");

          } else {

                    alert("There must be a selection that identifies the overset story.");

          }

          function fixOverset(story) {

                    while (story.overflows) {

                              var aDoc = story.parent;

                              var lastTF = story.textContainers.pop();

                              var lastPage = lastTF.parentPage;

                              if (lastPage instanceof Page == false) {

                                        alert("Story ends on pasteboard; no action taken.");

                                        return;

                              }

                              var master = lastPage.appliedMaster;

                              var newPage = aDoc.pages.add(LocationOptions.after, lastPage);

                              newPage.appliedMaster = master; // may not be necessary

                              var liveArea = getLiveBounds(newPage);

                              var newTF = newPage.textFrames.add({geometricBounds : liveArea, layer : lastTF.itemLayer});

                              newTF.previousTextFrame = lastTF;

                              if (newTF.insertionPoints.length == 0

                                                  && lastTF.insertionPoints.length == 0) {

                                        // allows for paragraph style with startParagraph on specific page side

                                        alert("Story is permanently overset.");

                                        return;

                              }

                    }

                    selectIt(story.insertionPoints[-1]);

          }

          function getLiveBounds(page) {

                    var rO = page.parent.parent.viewPreferences.rulerOrigin;

                    var bounds = page.bounds;

                    if (rO == RulerOrigin.spreadOrigin) return returnBounds(page, bounds);

                    var width = bounds[3] - bounds[1];

                    if (rO == RulerOrigin.spineOrigin &&

                                        (page.side == PageSideOptions.leftHand ||

                                                  (page.side == PageSideOptions.rightHand &&

                                                            page.parent.pages.length > 1)) ||

                              (rO == RulerOrigin.pageOrigin &&

                                        page.side == PageSideOptions.rightHand &&

                                                  page.parent.pages.length > 1)) {

                                        bounds[1] = bounds[1] - width;

                                        bounds[3] = bounds[3] - width;

                    }

                    return returnBounds(page, bounds);

                    function returnBounds(page, bounds) {

                              return [

                                        page.marginPreferences.top,

                                        page.side == PageSideOptions.leftHand ?

                                                  bounds[1] + page.marginPreferences.right :

                                                  bounds[1] + page.marginPreferences.left,

                                        bounds[2] - page.marginPreferences.bottom,

                                        page.side == PageSideOptions.leftHand ?

                                                  bounds[3] - page.marginPreferences.left :

                                                  bounds[3] - page.marginPreferences.right

                              ] ;

                    }

          }

           function selectIt(theObj) {

                    var myZoom = app.activeWindow.zoomPercentage;

                    app.select(theObj);

                    app.activeWindow.zoom(ZoomOptions.fitPage);

                    app.activeWindow.zoomPercentage = myZoom;

           }

}())

Translate
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
Guide ,
Apr 08, 2014 Apr 08, 2014

Hi Dave Saunders~

Thank you very much

Why are you so amazing~ very very great

It is very good,only, If there has been a blank page,Do not add a blank page

Translate
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
Guide ,
Aug 21, 2025 Aug 21, 2025
LATEST

@Dave_Saunders 

Can it first expand this page downward? If there is still text overflow when you reach the bottom of the page, add another page.

Translate
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