5 Replies Latest reply on Apr 8, 2014 8:07 AM by 喜狼_edny

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

    喜狼_edny Level 1

      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

        • 1. Re: Is there a script that it can make Overflow text automatically routed Next?(Not the main text frame)
          Luis Fernando Brito

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

                  }   

              };

          };

          • 2. Re: Is there a script that it can make Overflow text automatically routed Next?(Not the main text frame)
            喜狼_edny Level 1

            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

            • 3. Re: Is there a script that it can make Overflow text automatically routed Next?(Not the main text frame)
              Stefan Rakete Level 2

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

              Thanks Stefan

              • 4. Re: Is there a script that it can make Overflow text automatically routed Next?(Not the main text frame)
                Dave Saunders Level 4

                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;
                           }
                }())
                
                
                • 5. Re: Is there a script that it can make Overflow text automatically routed Next?(Not the main text frame)
                  喜狼_edny Level 1

                  Hi Dave Saunders~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