5 Replies Latest reply on May 19, 2015 10:07 PM by Qwertyfly...

    Hide PageItems in Separate Layer

    BEGINNER_X Level 3

      Hi All,

       

      New to Illustrator, but some knowledge in Indesign Scripting.

       

      Request:

      Need to find all hide pageitems and move in seperate script.

       

      For Illustrator, below code is not working

       

      #target illustrator 

      var myDoc = app.activeDocument; 

      for (var idx = 0; idx < myDoc.pageItems.length; idx++) 

          var pageItem = myDoc.pageItems[idx]; 

          if(pageItem.visible==false) 

          { 

              pageItem.layer.name = "Hide_Layer";//replace your layer name here 

          } 

      }

       

       

      But for Indesign, below coding is working fine

       

      var myDoc = app.activeDocument;  
      for (var idx = 0; idx < myDoc.allPageItems.length; idx++)  
      {  
          var pageItem = myDoc.allPageItems[idx];  
          if(pageItem.itemLayer.visible==false)  
          {  
              pageItem.itemLayer = "TestLayer";//replace your layer name here  
          }  
      }  
      
      

       

       

      Thanks in Advance

      Siraj