2 Replies Latest reply on Jan 16, 2017 2:53 AM by tpk1982

    Get the missing fonts from server

    tpk1982 Level 4

      Hi,

       

      I need to find the missing fonts from the server and store in a folder. This is like my question regarding Get the missing links from server

       

      Thanks Jump_Over for the script

       

      I tried to modify you coding for fonts, but not working as expected.

       

      var  
        i, j,  
        doc, imgs, path, cName, cFile,  
        imglist, searchfolder, movefolder;     
      for (j=0; j<app.documents.length; j++) {     
          doc = app.documents[j];     
          imgs = doc.fonts;     
          path = doc.filePath;     
          searchfolder = searchfolder || new Folder(path);     
          searchfolder = searchfolder.selectDlg(     
          "Find a path to "+doc.name+"'s images. Should contain "+     
              imgs[0].name+".*");     
           
          for (i=0; i<imgs.length; i++)     
          {     
        
              if (imgs[i].status != FontStatus.INSTALLED)     
              {     
        
                  cName = imgs[i].name;  
                  alert(cName)
                  imglist = findAnyFileDownThere(cName, searchfolder);     
                  if (imglist.length == 1)     
                  {     
                       movefolder = Folder(path + "/Recovered Fonts");   
                       if (!movefolder.exists) movefolder.create();  
                       cName = imglist[0].name;  
                       cFile = File(movefolder + "/"+ cName);  
                       if (!cFile.exists) imglist[0].copy(cFile);  
                  }     
              }     
          }     
      }     
      function findAnyFileDownThere (filename, path)     
      {     
      var result, folderList, fl;     
      result = Folder(path).getFiles (filename);     
      if (result.length > 0)     
        return result;     
      folderList = Folder(path).getFiles(function(item) { return item instanceof Folder && !item.hidden; });     
           
      for (fl=0; fl<folderList.length; fl++)     
      {     
        result = findAnyFileDownThere (filename, path+"/"+folderList[fl].name);     
        if (result.length > 0)     
        return result;     
      }     
      return [];     
      }  
      

       

      Please suggest where i missed.

       

      Thanks,

      K