3 Replies Latest reply on Feb 3, 2015 3:58 AM by Jump_Over

    about override all page

    hamdifem Level 1

      Located in the master page

      object style applied to a text frame (myobjstyle1)

      if only in the "Test" writes

      override it in all pages

      How to script

       

      var myDocument = app.activeDocument;    
      var TotalPages = (myDocument.pages.count());    
      for(var CurrentPage=0; CurrentPage < TotalPages; CurrentPage++) {    
           OverrideMasterItems();    
      }    
        function OverrideMasterItems() {  
          var theActiveOS = myDocument.objectStyles.item("myobjstyle1");
       
          var allItems = myDocument.pages[CurrentPage].appliedMaster.pageItems.everyItem().getElements();    
          for(var i=0;i<allItems.length;i++){    
              try{  
                  if (allItems[i].appliedObjectStyle == theActiveOS) {
                        //if(allItems[i].contents = "Test"                     //???
                      allItems[i].override(myDocument.pages[CurrentPage]);  
                  }  
              }   
              catch(e){}    
          }   
      }