3 Replies Latest reply on Jan 26, 2012 11:23 PM by கற்பனை (Imagine)

    how do I reference tagged text boxes

    mighty9403 Level 1

      Hi everybody

       

      Trying to learn this scripting to save some time and im starting with this script I found.

      basically I have a document with lots of datamerges i need to delete the text boxes that do not display any data merges.

       

      I have tried this but it doesnt work on my document but the script does work on a document with blank text frame. so this is my starting point.

      I have a text box that spans 12 pages it contains more textboxes that are exactly the same apart from the data merges are different. So do I tag the boxes and then refer to these boxes in the script to be able to delete the ones that do not contain any data.

       

      take a look at the pdf

       

      starting on page 4 and going to page 10 are the items i would like to target

       

      If there is no text in the text box personal english year 11 then I want to delete the whole group.

       

      the structure is A text box with 2 tables inside

       

      var myStories = app.activeDocument.stories.everyItem().getElements();
      for (i = myStories.length - 1; i >= 0; i--){
          var myTextFrames = myStories[i].textContainers;
          for (j = myTextFrames.length - 1; j >= 0; j--)    {
              if (myTextFrames[j].contents == ""){
                  myTextFrames[j].remove();
              }
          }
      }

       

      Its the middle section of this code I could do with some deconstruction.