Skip to main content
Known Participant
January 12, 2011
Question

How to delete old slug textframes

  • January 12, 2011
  • 1 reply
  • 1526 views

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.

This topic has been closed for replies.

1 reply

January 12, 2011

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;
     if (deleteMeTest(myItem)){
          myItem.remove();
     }
}
tansk02Author
Known Participant
January 13, 2011

Thank for your suggestion.