10 Replies Latest reply on Oct 30, 2013 2:10 AM by BEGINNER_X

    alert Missing Links comes only in Pages

    BEGINNER_X Level 3

      Hi All,

       

      I need to alert any missing images that comes in Pages (not in Master Spread)

       

      Ignore any missing Links that comes in Master Spread

       

      Using CS5.5

       

      Current coding is give alert for all the images used in Master spread or Spread.

       

      Trying Code is:

       

      var myUsedLinks = app.activeDocument.links;
      for (var i = 0; i < myUsedLinks.length; i++)
      {
           if(myUsedLinks[i].parent instanceof MasterSpread)
              {
                if (myUsedLinks[i].status == LinkStatus.linkMissing) 
                   {
                     alert("Please Fix Missing Link");
                     exit(0);
                }
              }
          }
      

       

      Could anyone please help me for this simple request.

       

      Thanks in advance

      Beginner_X

        • 1. Re: alert Missing Links comes only in Pages
          Sajeev Sridharan Level 4

          Change the "if" condition as below line:

           

           

               if(myUsedLinks[i].parent.parent.parent instanceof Spread || myUsedLinks[i].parent.parent.parent instanceof Page)

           

           

          Vandy

          1 person found this helpful
          • 2. Re: alert Missing Links comes only in Pages
            BEGINNER_X Level 3

            Hi Vandy,

             

            Excellent..... Its working fine.

             

            One more point I needed, but forgot to tell in the previous post.

             

            I need to ignore images  only for "UNUSED MASTER PAGES" in the document

             

            Not for all master pages.

             

            Sorry for the inconvenience.

             

            Please help.

             

            Thanks in advance

            Beginner_X

            • 3. Re: alert Missing Links comes only in Pages
              Sajeev Sridharan Level 4

              Images will be placed in Master Pages or  document pages.?

               

              Can you explain cleary

               

              Vandy

              • 4. Re: alert Missing Links comes only in Pages
                BEGINNER_X Level 3

                Hi Vandy,

                 

                Images comes in both Master Pages(icons) and Document Pages.

                 

                Currently trying script, but not suceeded

                 

                 

                var myMasterSpread = app.activeDocument.masterSpreads.everyItem().getElements();
                alert(myMasterSpread.length)
                
                //for(m=myMasterSpread.length-1; m>=0; m--)  //Here also problem
                //{
                    //myMasterSpread = myMasterSpread[m]
                   // }
                
                     for (var  n=app.activeDocument.pages.length-1; n>=0; n--)
                     {
                          if (app.activeDocument.pages[n].appliedMaster==myMasterSpread)  //
                          {
                            var myUsedLinks = app.activeDocument.pages[n].links;
                            
                            for (var i = 0; i < myUsedLinks.length; i++)
                            {
                                
                                 if(myUsedLinks[i].parent.parent.parent instanceof Spread || myUsedLinks[i].parent.parent.parent instanceof Page)
                                 {
                                      if (myUsedLinks[i].status == LinkStatus.linkMissing) 
                                         {
                                           alert("Please Fix Missing Link");
                                           exit(0);
                                      }
                                    }
                                }
                            }
                        }
                

                 

                 

                Thanks in advance

                Beginner

                • 5. Re: alert Missing Links comes only in Pages
                  Mi_D Level 3

                  try this

                   

                  var myPage = app.activeDocument.pages;

                  for (var p=0; myPage.length>p; p++){

                  var myUsedLinks = myPage[p].allGraphics;

                  for (var i = 0; i < myUsedLinks.length; i++)

                  {

                            if (myUsedLinks[i].itemLink.status.toString() == 'LINK_MISSING')

                               {

                                 alert("Please Fix Missing Link"+"==="+[i]);

                                 }

                      }

                  }

                  • 6. Re: alert Missing Links comes only in Pages
                    Sajeev Sridharan Level 4

                    Try this,

                     

                    //Use your master page name in "ïf" condition

                     

                         if(myUsedLinks[i].parent.parent.parent instanceof Spread && myUsedLinks[i].parent.parent.parentPage.appliedMaster.name=="A-Master" && myUsedLinks[i].parent.parent.parentPage.appliedMaster.name=="B-Master")

                     

                    Vandy

                    • 7. Re: alert Missing Links comes only in Pages
                      BEGINNER_X Level 3

                      Hi Mi_D,

                       

                      Thanks for your response,

                       

                      Provided script get alert for missing links comes only in pages not for the "USED MASTERSPREADS" links

                       

                      Thanks

                      Beginner

                      • 8. Re: alert Missing Links comes only in Pages
                        Mi_D Level 3

                        your requirement is show missign image link document page not in master page

                         

                        show what is given it's check only document pages not master pages

                         

                        any think u went

                        • 9. Re: alert Missing Links comes only in Pages
                          Jump_Over Level 5

                          Hi,

                           

                          If the goal is to alert ==> use preflightProfile. Just define pure "links_checker" custom profile and activate it. It will alert only used links errors.

                           

                          app.activeDocument.activeProcess.processResults.length > 6;
                          

                           

                          Your doc has "used links problems" if above is true:

                           

                          Jarek

                          • 10. Re: alert Missing Links comes only in Pages
                            BEGINNER_X Level 3

                            Hi Jump/Vandy/Mi_D,

                             

                            Thanks for all your support...

                             

                            I give Helpful answers for Vandy.

                             

                            I got solution by different way by using User Interface.

                             

                            Thanks

                            Beginner_X