5 Replies Latest reply on Apr 6, 2016 9:12 AM by runew73276507

    Textoverset and missing links and fonts

    runew73276507 Level 1

      Hi,

       

      OBS: this is for InDesign CS3 use

       

      I have this script which checks for overset text:

       

      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) { 
       
           alert("No oversets found on pages."); 
       
         } else{ 
       
           var s = ""; 
       
           for (i in thePageNames) {  
       
             s = s + app.documents[0].pages[Number(i) - 1].name + ", "; 
       
           } 
       
           s = s.substring(0,s.length - 2); 
       
           alert("Check for oversets on page(s): " + "\n" + s); 
       
         }
       
       } else { 
       
         alert("No documents are open."); 
       
       }
      


      I need it to fit into this script:


      var doc = app.activeDocument; 
      var _PDFExportPreset = app.pdfExportPresets.item('MyPDFSetting');
      if (_PDFExportPreset == null){  
         alert('Preset is missing');  
         exit();  
      }  
      var _DocName = doc.name.replace(/\.indd/, "");  
      var _EndNumber = parseInt(_DocName.match(/\d{3}$/),10); /* extract end number */  
      /* test if is a number */  
      if (isNaN(_EndNumber)){  
          alert('End document name is not a number');  
          exit();  
      }  
        
      for(i = 0; i < doc.pages.length; i++){  
          _PageName = doc.pages.item(i).name;  
          app.pdfExportPreferences.pageRange = _PageName;  
          _NewNumber = _EndNumber + i; /* incresase number */  
          _NewNumber = ("00"+_NewNumber).slice(-3); /* padding */  
          _DocName = _DocName.replace(/\d{3}$/,_NewNumber); /* replace number in doc name */  
          _PDFfile = new File('\\\\Testserver\\Test\\'.concat(_DocName,'.pdf'));  
          doc.exportFile(ExportFormat.pdfType, _PDFfile, false, _PDFExportPreset);  
      }
      
      //If the active document has been changed since it was last saved, save it.
      if(app.activeDocument.modified == true){
       app.activeDocument.save();
      }
      //Closes the active document.
      app.activeDocument.close()
      ;
      

       

      So if there is NO text overset I need the script to continue run and of there IS overset text inside the document frame and on the active layer I need it to alert and stop. If it is possilble I would also like that it is possible for the user to ignore the overset text and then make the script continue run.

       

      AND I would also like that it checks for Missing and/or out of date links AND missing fonts in the same princip as the overset text.

        • 1. Re: Textoverset and missing links and fonts
          runew73276507 Level 1

          I still need help if anyone has a solution

          • 2. Re: Textoverset and missing links and fonts
            tpk1982 Level 4

            Please use function and confirm available in JavaScript. So you can call the pdf script from the end of first function

             

            JavaScript Functions

             

            http://www.w3schools.com/jsref/met_win_confirm.asp

            • 3. Re: Textoverset and missing links and fonts
              b91823603 Level 3

              Hi runew73276507,

               

              Modify the code as shown below,

               

              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) {  

                

                   alert("No oversets found on pages.");  

                

                 } 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("Check for oversets on page(s): " + "\n" + s+"\nDo you want to continue..."))

                   exit();

                

                 } 

                

              } else {  

                

                 alert("No documents are open.");  

                 exit();

               

              //then write your code here....

              • 4. Re: Textoverset and missing links and fonts
                runew73276507 Level 1

                Hi Dilibabu,

                 

                Thank you very much for your help - I got it to work for my needs with some small corrections:

                 

                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("Check for oversets on page(s): " + "\n" + s+"\nDo you want to continue..."))
                     exit();
                  
                   } 
                }
                

                 

                 

                Now I am trying to modify same script so it with same princip can check for missing or out of date links AND missing fonts - can you help me out here also?