1 Reply Latest reply on Jul 9, 2016 12:03 AM by karthiks94217840

    Write Error log report

    karthiks94217840 Level 2

      Dear Friends,

       

      I need your help guys. (package) more than 500 document i need to use this following script.

       

      @My script working way:

      1. Collect ".csv" file data - working good.

      2. Go to path and open indd file - working good.

      3. Create package folder - working good.

      *4. Write error reports - I need help here.

       

      @I need create type of error reports:

      1. In path, more than one indd file / No indd file found.

      2. Missing font.

      3. Missing figure.

       

      In above list, i need to create log report in single file (.txt format) for ".csv" file path:

       

      I have place the my code is below. Please modified my code friends.

       

      var basePath = "C:/Documents and Settings/informa.EXETERPM/Desktop/z";//Server folder base path 
      var basePathFiles = Folder(basePath).getFiles();
      var basePathFilesLen = basePathFiles.length;
      
      
      var csvFile = File.openDialog("Choose the CSV Open file *.csv","*.csv", false);  
          if (csvFile != null) {  
              csvFile.open('r');  
              var read = csvFile.read(); 
              csvFile.close();
          } else {
                  alert ("Please select CSV file"); exit(); 
              }
      
      
          var articleID;
          var readvalue = read.split("\n");
            var readvaluelength = readvalue.length;
            for (var i=0; i < readvaluelength-1; i++)
           {
               articleID = readvalue[i].split(",")[0
                  for (var bsf = 0; bsf < basePathFilesLen; bsf ++){
                      if (basePathFiles[bsf] instanceof Folder){
                          var articleFolder = Folder(basePathFiles[bsf].fullName + '\\' + articleID);
                          if (articleFolder.exists){
                              var curdocfiles = Folder (articleFolder + '\\' + articleID + '_Application\\').getFiles('*.indd');
                              var curdocfilescount = curdocfiles.length;
                              if (curdocfilescount > 1 || curdocfilescount < 1) {
                                  alert("More than one Indesign file" + articleFolder + articleID)
                                  }
      
      
      app.open(File(curdocfiles));
        var too = Folder.selectDialog ("Enter the Outputpath");
        if (too ==null || too =="")
        exit(0);
      
          var to = new File(too + '\\' + articleID + '\\' + articleID + '_Package');
          var flag = Folder(to).create();
              var copyingFonts = true;
              var copyingLinkedGraphics = true;
              var copyingProfiles = true;
              var updatingGraphics = true;
              var includingHiddenLayers = true;
              var ignorePreflightErrors = true;
              var creatingReport = true;
              var versionComments = "comment";
              var forceSave = true;
      
      
                  if ( flag === true){
                      app.activeDocument.packageForPrint (
                            to, 
                            copyingFonts, 
                            copyingLinkedGraphics, 
                            copyingProfiles, 
                            updatingGraphics, 
                            includingHiddenLayers,
                            ignorePreflightErrors, 
                            creatingReport, 
                            versionComments,
                            forceSave
                           );
                  }
             app.documents.item(0).close();
                          break;
                          }
                      }
                  }
           } 
      alert("Process Completed");
      

       

      Please suggest guys, this is very urgent process.

       

      Thanks in Advance.