2 Replies Latest reply on Jan 13, 2011 12:18 AM by tansk02

    How to delete old slug textframes

    tansk02

      Hi all,

       

      I have several indesign files which have slugline on Layer 1 and Layer 2 pasted on left master pages slug area (20mm).

       

      I am trying to remove this textframes by index(), but it deletes running head text boxes sometime other textboxes. Because every text files slug text frames index is not consistent. In my indesign files there are some other textboxes placed on master pages for running head and folio etc..

       

      Is it possible to delete this old slug textframes from master pages through javascript?

       

      Please help me.

       

      Tansk.

        • 1. Re: How to delete old slug textframes
          Haakenlid Level 3

          You can loop through all page items and decide if it should be deleted.

           

          This script will delete any page Item that extends 10mm or more to the left of the spread. But you can change the test i the function deleteMeTest to be anything that helps you identify the pageObjects that you want to get rid of. my "deleteMeTest" is just one line, but you can make the function as complicated as you want.

           

          Remember to save your document before running this script, because every single item that gets deleted needs a seperate undo if you remove some stuff you wanted to keep.

           

           

          var myPageItems = app.activeDocument.pageItems;
          var myItem; 
          
          var deleteMeTest = function(myPageItem){ // returns true if this item should be deleted 
               // change this function to a good test of whether myPageItem is one of the slug TextFrames you want to get rid of.
               return (myPageItem.geometricBounds[1]<-10)
          }
          
          for (var n=myPageItems.length-1;n>=0;n-=1){
               myItem = myPageItems[n];
               if (deleteMeTest(myItem)){
                    myItem.remove();
               }
          }
          • 2. Re: How to delete old slug textframes
            tansk02 Level 1

            Thank for your suggestion.