4 Replies Latest reply on Feb 7, 2016 6:22 PM by Sudha K

    Save Preflight Report

    Sudha K Level 1

      Hi,

       

       

           I am saving the report of preflight report in InDesign CS6. The below code is used to save the report.  its working but when I use this code inside function its not working.  I dono the issue.  Can any help me.

       

       

       

          var preflightName = "test";

          var myDoc = app.activeDocument;

          var preflightProfile = app.preflightProfiles.item(preflightName);

          var preflightProcess = app.preflightProcesses.add(myDoc, preflightProfile);

          var waitProcess = preflightProcess.waitForProcess();

          var result = preflightProcess.processResults;

       

          if (result != 'None')

          {

              var errors = preflightProcess.aggregatedResults[2];

              alert("Preflight : " + preflightProcess.aggregatedResults[2].length + " error(s) ");     

              if(errors.length > 0)               // Errors count

              {

                  alert("check " +myDoc.fullName.fsName.replace(".indd",".txt"))

                  preflightProcess.saveReport(File(myDoc.fullName.fsName.replace(".indd",".txt")),true);

                  preflightProcess.remove();              // Cleanup

              }

          }

       

       

      - Sudha K

        • 1. Re: Save Preflight Report
          Laubender Adobe Community Professional & MVP

          How is the function constructed?
          How is the function executed?

           

          Uwe

          • 2. Re: Save Preflight Report
            Sudha K Level 1

            Hi,

             

                 Code using function is the given below.

             

            test()

             

            function test()

            {

                var preflightName = "test";

                var myDoc = app.activeDocument;

                var preflightProfile = app.preflightProfiles.item(preflightName);

                var preflightProcess = app.preflightProcesses.add(myDoc, preflightProfile);

                var waitProcess = preflightProcess.waitForProcess();

                var result = preflightProcess.processResults;

             

                if (result != 'None')

                {

                    var errors = preflightProcess.aggregatedResults[2];

                    alert("Preflight : " + preflightProcess.aggregatedResults[2].length + " error(s) ");     

                    if(errors.length > 0)               // Errors count

                    {

                        alert("check " +myDoc.fullName.fsName.replace(".indd",".txt"))

                        preflightProcess.saveReport(File(myDoc.fullName.fsName.replace(".indd",".txt")),true);

                        preflightProcess.remove();              // Cleanup

                    }

                }

            }

            • 3. Re: Save Preflight Report
              Loic.Aigon Adobe Community Professional

              I can't see a major flaw here unless maybe some possible issues but not specially related to teh original issue.

               

              So given that the code construction wouldn't be the main issue, did you check what the "result" value is ? If different of 'None', your function does…nothing thus possibly giving the feeling the function isn't working.

              Another possible issue (tweasted I admit) would be that a secondary test function is defined or has been defined in a session script. So that second function flattened yours.

               

              At your point, I would be an elementary step by step debugging by placing alerts everywhere to see where your function stops.

               

              Loic

              • 4. Re: Save Preflight Report
                Sudha K Level 1

                Hi,

                 

                     Thank you.. when I debugging step by step i found the issue in the script "ExportPreflightReport.jsx".  I got the solution from this forum from the below url.  The same issue happened to me.

                 

                Problem with save preflight report using javascript in macintosh

                 

                Thank you...

                 

                - Sudha K