Copy link to clipboard
Copied
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.appliedObjectStyle == "tmc"){
myObj.remove()
}
}
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.page
Copy link to clipboard
Copied
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;
if (curItem.appliedObjectStyle.name == "tmc") {
curItem.remove();
}
}
best
Kai
Find more inspiration, events, and resources on the new Adobe Community
Explore Now