1 Reply Latest reply on Jun 25, 2016 10:15 AM by Kai Rübsamen

    not master page

    hamdifem Level 1

      I want to delete only pages

      not on a master page

      Deleting a master page

      What is done to prevent it


      var myDoc = app.activeDocument;   

      var myObj= myDoc.allPageItems;


      for(var i=0; i< myObj.length; i++) 

          if(myObj[i].appliedObjectStyle == "tmc"){ 




        • 1. Re: not master page
          Kai Rübsamen Level 4

          Hamdifem, if you would write in my forum, no one would give you an answer, because there is no friendly "hello", no greeting to the end. The code isn’t insert with syntaxhighlighting, the question is not realy clear: … delete pages not on master pages … or do you want to delete page items, if they are not on master pages?


          Anyway, if you want to delete objects with a applied objectstyle "tmc" only on document pages, you can try the following.


          var curDoc = app.activeDocument;
          var pItems = curDoc.pages.everyItem().pageItems.everyItem().getElements();
          var curItem;
          for (var i = pItems.length-1; i >= 0; i--) {
            curItem = pItems[i];
            if (curItem.appliedObjectStyle.name == "tmc") {