2 Replies Latest reply on Feb 23, 2017 9:26 PM by tpk1982

    Need data in every row (excel log file)

    tpk1982 Level 4

      Hi,

       

      Good day. I am trying to get the error log report as xls format for missing fonts and missing links. But unfortunately i can get the error datas in the same row. Also am trying to get the data  in every column.

       

      The below screenshots may give clear picture.

       

      My output now

       

      Screen Shot 2017-02-23 at 3.21.25 PM.png

       

      Desired output

       

      Screen Shot 2017-02-23 at 3.22.06 PM.png

       

      or even better

       

      Screen Shot 2017-02-23 at 3.23.54 PM.png

       

      Tried coding:

       

      var log="";
      
      
      getfilename();     
      
      
      var arr1=[];   
      var arr2=[];    
      
      
      function OutFoldXLS(App_Path,App_name,a1,a2){
          var myLogFile = new File(App_Path + "/" + App_name+".csv");
          myLogFile.open("w", undefined, undefined)
          myLogFile.write(a1+","+a2+","+"\n"); 
          myLogFile.close();
          alert("Report Saved in Desktop"+"\r"+"Click OK to see the report now")
          myLogFile.execute();   
         }  
      
      
      
      
      
      
      function getfilename()
      {
          docRef = app.activeDocument;
        docName=docRef.name
          //number of links not dublicate
           myallLinks = docRef.links.everyItem().getElements(),  
          linknames = [];  
        for(var i =0;i<myallLinks.length;i++)  
        {  
        linknames.push(myallLinks[i].name)  
        }  
        linknames.sort();   
        found = [];  
          found1 = [];  
      
      
        for(var i=0;i<linknames.length-1;i++)  
        {  
        if(linknames[i+1]==linknames[i])  
        {  
        found.push(linknames[i]);  
        }  
          else{
              found1.push(linknames[i]); 
              }
        }
      var myresults=found.concat(found1);
      getMissingFonts();
      OutFoldXLS("~/Desktop","Test",myresults.join("\n"), missingFonts.join("\n"))
        }
      
      
      //missing fonts
      
      
      function getMissingFonts(){
          missingFonts = new Array()
        var flag1=0
        var usedFonts = app.activeDocument.fonts;  
        for (var i=0; i<usedFonts.length; i++) {  
        if(usedFonts[i].status != FontStatus.INSTALLED){  
                      missingFonts.push(usedFonts[i].postscriptName);
        flag1=1;
        }  
        }
        if(flag1==1){
              log=log+missingFonts+"\n\n"
        }
      }
      

       

       

      Advance Thanks,

      K