Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

not master page

Participant ,
Jun 24, 2016 Jun 24, 2016

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() 

     }

}

TOPICS
Scripting
297
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Jun 25, 2016 Jun 25, 2016

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

...
Translate
Enthusiast ,
Jun 25, 2016 Jun 25, 2016
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines