7 Replies Latest reply on Aug 4, 2017 6:21 AM by tpk1982

    Getting group image name

    tpk1982 Level 4

      HI,

       

      I need to collect the image names from the document. It should ignore if the image layer is hidden, pasteboard images. Also if two images grouped then we need those names also. The below my coding throw error.

       

      getfilename()
      function getfilename(){
      docRef = app.documents[0];
           myallLinks = docRef.links.everyItem().getElements();  
          linknames = [];  
      
      
        for(var i =0;i<myallLinks.length;i++){  
              if ((myallLinks[i].status != LinkStatus.LINK_MISSING) && myallLinks[i].parent.parent.parent.constructor.name=="Group" && myallLinks[i].parent.parent.itemLayer.visible == true && myallLinks[i].parent.parent.parentPage != null){     
                      linknames.push(myallLinks[i].name)  
              }
              if ((myallLinks[i].status != LinkStatus.LINK_MISSING) && myallLinks[i].parent.parent.parent.constructor.name=="Page" && myallLinks[i].parent.parent.itemLayer.visible == true && myallLinks[i].parent.parent.parentPage != null){     
                      linknames.push(myallLinks[i].name)  
              }
              if ((myallLinks[i].status != LinkStatus.LINK_MISSING) && myallLinks[i].parent.parent.parent.constructor.name=="Spread" && myallLinks[i].parent.parent.itemLayer.visible == true && myallLinks[i].parent.parent.parentPage != null){     
                      linknames.push(myallLinks[i].name)  
                  }
          }
        linknames.sort();   
      
      
          var found = [];  
         
        for(var i=0;i<linknames.length;i++){    
              var flg=found.toString().indexOf (linknames[i]);
              if(flg==-1){
                  found.push(linknames[i]);     
              }
        }
       alert(found.join("\n"));
      
      
      }
      
      

       

      Please suggest.

       

      Thanks,

      K