2 Replies Latest reply on Jun 9, 2017 6:06 AM by mikeb41294032

    Script who can check for missing font

    runew73276507

      In this script for use in InDesign CS3:


      var doc = app.documents[0];
      var mExitFlag = false;
      
      var mTextFrames = doc.textFrames;
      for(var i = 0; i < mTextFrames.length; i++){
          if (mTextFrames[i].parentStory.overflows && checkIfOnPage(mTextFrames[i]) && mTextFrames[i].itemLayer.visible == true){
              alert('To much text' )
              mExitFlag = true;
          }
      }
      
      var mLinks = doc.links;
      for(var i = 0; i < mLinks.length; i++){
          if ((mLinks[i].status == LinkStatus.LINK_MISSING || mLinks[i].status == LinkStatus.LINK_OUT_OF_DATE) && checkIfOnPage(mLinks[i].parent.parent) && mLinks[i].parent.parent.itemLayer.visible == true ){
              alert('Missing or not updated link' );
              mExitFlag = true;
          }
      }
      
      
      if(mExitFlag){    
          exit();    
      }
      
      function checkIfOnPage(mItem){     
          var _OldZeroPoint = app.activeDocument.zeroPoint;    
          app.activeDocument.zeroPoint = [0,0];    
          
          var _Width =app.activeDocument.documentPreferences.pageWidth;    
          var _Height=app.activeDocument.documentPreferences.pageHeight;    
          
          
          var _Bounds = mItem.geometricBounds;    
          
          if ((_Bounds[3] < 0)  || (_Bounds[1] > _Width) || (_Bounds[0] > _Height) || (_Bounds[2] < 0)){    
              return false    
          }else{    
              return true    
          }    
          app.activeDocument.zeroPoint =_OldZeroPoint;    
      }
      var doc = app.activeDocument;
      var _PDFExportPreset = app.pdfExportPresets.item('NewspaperAds_1v4_IND4');
      if (_PDFExportPreset == null){
         alert('Preset 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();
      }
      
      

       

      I also would like it to check for missing fonts - is that possible?