3 Replies Latest reply on Mar 25, 2016 11:09 AM by Laubender

    Mark overset text frame with tag

    James Babenok

      I got a huge translated catalog which has fixed text frames. The translated text do not fit.

      So I have to manualy resize each text frame.

      I managed to find replace part of the frames, based on Object - Text Frame General Options - Width (all of the frames in question have fixed size)

      But the rest of them could be found using that method, don't know why.

      So I found a small script which alerts user if it finds overset text frames.


      var doc = app.activeDocument;    
      var mTextFrames = doc.textFrames;  
      for(var i = 0; i < mTextFrames.length; i++){  
          if (mTextFrames[i].parentStory.overflows){  
              alert('Overset TextFrames detected' );  

      Could you help me find a script which will add tag to the overset text frames?

        • 1. Re: Mark overset text frame with tag
          Laubender Adobe Community Professional & MVP

          Hi James,

          with doc.textFrames you would not find nested text frames (grouped, pasted inside or anchored ones).


          Why don't you use InDesign's Preflight feature?
          You could go to the text frames that overflow from notified errors immediately.


          What do you mean by "add tag"?

          Apply a fill color to the one that overflows or something?



          • 2. Re: Mark overset text frame with tag
            James Babenok Level 1

            Preflight is good, but there're over 300 errors

            • 3. Re: Mark overset text frame with tag
              Laubender Adobe Community Professional & MVP

              Hi James,

              you could loop all stories of the document.


              Here an example, that will work for all text frames, nested in groups or pasted inside graphic frames or anchored to text.

              You just have to add code to do something with the found ones.


              In my example I will just fill the found ones with color Magenta. Or in case of found textPaths, I also change the color of the stroke.

              That is not exactly what you want. But you can add your own code to the function doSomethingWithTextContainers() .

              Read my comments in the script carefully. The script's action can be undone in one go.


              app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
                  "Detect Overflowing TextFrames | SCRIPT"
              function detectOverflowingTextFrames()
              var storyArray = app.documents[0].stories.everyItem().getElements();
              var storyArrayLength = storyArray.length;
              // A loop through all the stories of the document:
              for(var n=0;n<storyArray.length;n++)
                  // The condition should be clear.
                  // However, there is one rare case where overflows is false,
                  // but the text frame is showing a red + sign:
                  // If a footnote text overflows in the last frame of a threaded story.
                      // TextContainers could be textFrames and textPaths !!
                      var textContainersArray = storyArray[n].textContainers;
                      var lastTextContainer = textContainersArray[textContainersArray.length-1];
                      // A function call to the last text frame, if its story overflows:
              function doSomethingWithTextContainers(/*textFrame or textPath*/textContainer)
                  if(textContainer.constructor.name == "TextFrame") // Could be text on path as well
                      // Here your code that is changing the size of your frame
                      // In my example code here it will only fill the frame with color Magenta:
                      textContainer.fillColor = "Magenta";
                      // If you want to move the text frame, consider to unlock it first, if it is locked.
                  if(textContainer.constructor.name == "TextPath")
                      // Here your code, if text on a path should overflow.
                      // Depending on the pageItem that holds the path, the parent should be the pageItem you are interested in.
                      // Usually a graphicLine or a polygon. Could also be an oval, a rectangle or even a textFrame.
                     textContainer.parent.fillColor = "Magenta";
                     textContainer.parent.strokeColor = "Magenta";




              1 person found this helpful