3 Replies Latest reply on Dec 4, 2014 6:51 AM by haynesc87

    Find Overlap Frames Pages

    BEGINNER_X Level 3

      Hi All,

       

      Could you please help to find the pages containing Overlap frames (Graphics or text frames).

       

      Thanks in advance

      Beginner_X

        • 1. Re: Find Overlap Frames Pages
          ping rajesh

          Hi,

           

          You can try as below:

           

          var myDoc=app.activeDocument;
          var overlapArray = new Array();
          var myPages = app.activeDocument.pages.everyItem().getElements();
          
          for(i=0; i<myPages.length; i++)
          {
              var myPgItems = myPages[i].allPageItems;
              for(k=0; k<myPgItems.length; k++)
              {
               var bounds1 = myPgItems[k].geometricBounds;
                      for(j=0; j<myPgItems.length; j++)
                           {
                             var bounds2 = myPgItems[j].geometricBounds;
                               if(k==j)
                               {
                                   continue;
                               }
                              var temp = touches(bounds1, bounds2);                   
                              if(temp == true)
                              {
                                  overlapArray.push(myPages[i].name)
                              }
                       }
                   }
           }
          alert("overlap Pages: "+overlapArray);
          
          function touches(bounds1, bounds2)
          {
          if (bounds1[2] < bounds2[0]) return false;
          if (bounds1[0] > bounds2[2]) return false;
          if (bounds1[1] > bounds2[3]) return false;
          if (bounds1[3] < bounds2[1]) return false;
            return true;
          } 
          

          Thanks,

          Rajesh

          • 2. Re: Find Overlap Frames Pages
            BEGINNER_X Level 3

            Hi Ping,

             

            Awesome.... Working fine in my end...

             

            You save my timing

             

            Again thanks a lot!!!

             

            Thanks

            Beginner_X

            • 3. Re: Find Overlap Frames Pages
              haynesc87

              How do you use this - what is the process of saving this as a file and what file type please?

              haynesc87@gmail.com