4 Replies Latest reply on Apr 7, 2016 1:56 AM by runew73276507

    Modify excisting script to check for missing or out of date links AND missing fonts

    runew73276507

      OBS: InDesign CS3 script:

       

      I have this script:

      if (app.documents.length != 0){ 
      
         var myFrames = app.activeDocument.textFrames; 
      
         var thePageNames = new Array(); 
      
         for (var j = 0 ; j <= (myFrames.length - 1); j++) { 
      
           if(myFrames[j].overflows == true){ 
      
             try {
      
               thePageName = myFrames[j].parent.documentOffset;
      
             } catch (e) { 
      
               continue; // must be on Pasteboard so ignore
      
             }
      
             thePageNames[thePageName] = 1 
      
           } 
      
         } 
      
      
         if (thePageNames.length == 0) {  
        
        
         } else{  
      
             var s = ""; 
      
           for (i in thePageNames) {  
      
             s = s + app.documents[0].pages[Number(i) - 1].name + ", "; 
      
           } 
      
           s = s.substring(0,s.length - 2); 
      
           if(!confirm("Overset text on page - continue?"))
           exit();
      
         }
      }
      
      

       

      With the same princip and funtion I would like it to also check for:

       

      1. Missing or Out of date links

      2. Missing fonts

       

      Can anyone help me rewrite this? I have tried with this for the links part but nothing happens when I run the script:

       

      if (app.documents.length != 0){ 
      
         var myLinks = app.activeDocument.links; 
      
         var thePageNames = new Array(); 
      
         for (var j = 0 ; j <= (myLinks.length - 1); j++) { 
      
           if(myLinks[j].status == LinkStatus.LINK_MISSING || myLinks[i].status == LinkStatus.LINK_OUT_OF_DATE == true){ 
      
             try {
      
               thePageName = myLinks[j].parent.documentOffset;
      
             } catch (e) { 
      
               continue; // must be on Pasteboard so ignore
      
             }
      
             thePageNames[thePageName] = 1 
      
           } 
      
         } 
      
      
         if (thePageNames.length == 0) {  
        
        
         } else{  
      
             var s = ""; 
      
           for (i in thePageNames) {  
      
             s = s + app.documents[0].pages[Number(i) - 1].name + ", "; 
      
           } 
      
           s = s.substring(0,s.length - 2); 
      
           if(!confirm("Missing or not updated links in document - continue?"))
           exit();
      
         }
      }
      
      
        • 1. Re: Modify excisting script to check for missing or out of date links AND missing fonts
          biozaichenko Level 1

          I think this should get you started.

           

          if (app.documents.length != 0) { 

             var myLinks = app.activeDocument.links;  

             var thePageNames = new Array();  

             for (var j = 0 ; j < myLinks.length; j++) {  

               if(myLinks[j].status == LinkStatus.LINK_MISSING || myLinks[i].status == LinkStatus.LINK_OUT_OF_DATE){  

                 if (myLinks[j].parent.parentPage.isValid) { 

                    thePageNames.push (myLinks[j].parent.parentPage.documentOffset);

                 } else {  

                   thePageNames.push ("Pasteboard");

               }  

             }  

             if (thePageNames.length > 0) {   

               alert (thePageNames.length + "missing or not updated links in document.")) 

             }

          }

          }

           

          Michael

          • 2. Re: Modify excisting script to check for missing or out of date links AND missing fonts
            b91823603 Level 3

            Hi,

             

            I modified 13th line in your code it will work and then added code for font missing also. Try this

             

            if (app.documents.length != 0)

            {

                var MY_DOC = app.activeDocument;

               var myLinks = MY_DOC.links;  

              

               var thePageNames = new Array();  

               for (var j = 0 ; j <= (myLinks.length - 1); j++)

               {  

                    if(myLinks[j].status == LinkStatus.LINK_MISSING || myLinks[i].status == LinkStatus.LINK_OUT_OF_DATE == true){  

                   try

                   {   

                        thePageName = myLinks[j].parent.parentPage.documentOffset; 

                   }

                   catch (e)

                   {    

                        continue; // must be on Pasteboard so ignore 

                   }   

                    thePageNames[thePageName] = 1 

                 }    

               }    

             

                if (thePageNames.length != 0)

               {     

                    var s = "";    

                    for (i in thePageNames)

                    {     

                        s = s + app.documents[0].pages[Number(i) - 1].name + ", ";    

                    }    

                    s = s.substring(0,s.length - 2);    

                    if(!confirm("Missing or not updated links in document - continue?")) 

                        exit();   

                    if(fun_FontMissing)

                         if(!confirm("Font missing in document - continue?")) 

                            exit();       

               } 

             

            function fun_FontMissing()

            {

                var isFontMis=false;   

                try{

                    for(var i=0;i<MY_DOC.fonts.count();i++){

                        if(MY_DOC.fonts[i].status==1718832705 || MY_DOC.fonts[i].status == 1718834037 || MY_DOC.fonts[i].status == 1718830689){

                            isFontMis=true;

                        }

                    }

                }

                catch(ex){

                    alert(ex);

                    exit();

                }

                return isFontMis;

            }

            • 3. Re: Modify excisting script to check for missing or out of date links AND missing fonts
              runew73276507 Level 1

              It does not work in InDesign CS3

               

              It works fine in InDesign CC 2015 - but I need this for CS3 - can you assist me once more?

              • 4. Re: Modify excisting script to check for missing or out of date links AND missing fonts
                runew73276507 Level 1

                And by the way - If you press "YES" to continue for the missing or out of date link part it also alert for a missing font even thoe there is no fonts used in the document?