3 Replies Latest reply on Aug 13, 2014 9:47 PM by Sajeev Sridharan

    Find marks in page

    AsOne Level 1

      Hi All,

       

      I am finding the marks with layer inside of the page, it shows only in spread. what is my wrong

      Can any one help.

       

      var mydoc = app.activeDocument;
      var myOPs=mydoc.layers.everyItem().getElements();
      for (i=0; i<myOPs.length; i++) {
          var myOP=myOPs[i];
          if(myOP.name=="myCropMarks-MAGENTA") {
      tt = myOP.graphicLines.everyItem().getElements();
          for(k=0; k<tt.length; k++){
             alert( tt[k].parent.constructor.name)  
      if(tt[k].parent.constructor.name!="Spread"){
      }}
      }
      }
      

       

       

      Thanks in Advance

      Steve

        • 1. Re: Find marks in page
          Sajeev Sridharan Level 4

          Try this,

           

          var mydoc = app.activeDocument;  
          var myOPs=mydoc.layers.everyItem().getElements();  
          for (i=0; i<myOPs.length; i++) {  
              var myOP=myOPs[i];  
              if(myOP.name=="myCropMarks-MAGENTA") {  
          tt = myOP.graphicLines.everyItem().getElements();
              for(k=0; k<tt.length; k++){  
                  alert(tt[k].parentPage.constructor.name);
          if(tt[k].parent.constructor.name!="Spread"){  
          }}  
          }  
          }
          

           

          Vandy

          • 2. Re: Find marks in page
            AsOne Level 1

            Hi Vandy88, Thanks for your reply The parentPage is throwing error of "null is not an object" Thanks Steve

            • 3. Re: Re: Find marks in page
              Sajeev Sridharan Level 4

              The graphics line must be in a Page or Spread... Check your Graphic Line placement in InDesign...

               

              Or use try/catch to find the object...

               

              var mydoc = app.activeDocument;  
              var myOPs=mydoc.layers.everyItem().getElements();  
              for (i=0; i<myOPs.length; i++) {  
                  var myOP=myOPs[i];  
                  if(myOP.name=="myCropMarks-MAGENTA") {  
              tt = myOP.graphicLines.everyItem().getElements();
                  for(k=0; k<tt.length; k++){  
                      tt[k].select();
                      try{
                      alert(tt[k].parentPage.constructor.name);
                      }catch(e){alert("Object not in page.... Pls check...")};
              if(tt[k].parent.constructor.name!="Spread"){  
              }}  
              }  
              }
              

               

               

              Vandy