• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Save preflight report...

Contributor ,
Mar 27, 2018 Mar 27, 2018

Copy link to clipboard

Copied

Hi,

     I am using the below code to export preflight report.  It was working fine but now i am getting some error in the line aggregatedResults .  I could not get why its happening?

         

     Code:

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

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

          var waitProcess = preflightProcess.waitForProcess();

          var result = preflightProcess.processResults;

          alert("result" + result + "\n" + myDoc.name)

          if (result != 'None')

          {

              var errors = preflightProcess.aggregatedResults[2];

               //alert("Preflight : " + preflightProcess.aggregatedResults[2].length + " error(s) " + "\n" + myDoc.name);   

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

               {                                                  

                    var txtFilePath = myDoc.filePath.fsName + "/" + myDoc.name;                                                                                                             

                     preflightProcess.saveReport(File(txtFilePath.replace(".indd",".txt")));

                     preflightProcess.remove();

                  

                }

           }

     Screen Shot 2018-03-28 at 9.39.08 AM.png

     I don't know the reason.. why its throwing the error... Sometimes its not throwing any error...

TOPICS
Scripting

Views

694

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Mar 28, 2018 Mar 28, 2018

Copy link to clipboard

Copied

Hard to tell right away. Set a breakpoint before accessing the property and see what "aggregatedResults" actually is.

$.bp();

var errors = preflightProcess.aggregatedResults[2];

The code should stop and the data browser should let you know inspect current objects state.

HTH

Loic

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 28, 2018 Mar 28, 2018

Copy link to clipboard

Copied

Hi,

     Thank you...

     I debug and checked in ExtendScript Toolkit but i did not do in an InDesign Applicaiton.

     I will check how to do in InDesign Application.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Mar 28, 2018 Mar 28, 2018

Copy link to clipboard

Copied

You actually need to target InDesign as application. Once that done, you will be all set to debug.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 28, 2018 Mar 28, 2018

Copy link to clipboard

Copied

     I debug the code... its show clear runtime error in "Extendscript Toolkit" in the line "var errors = preflightProcess.aggregatedResults[2];"...

     Dont know how to rectify the error...

     if i run the below code for an active document its working.. but when i run it for batch process its throwing the error.

   

     I could not get the reason where i did mistake and what is the issue...

     Code:

preflightName = "FileValidate";

preflightReport()

alert("Exit");

exit()

function preflightReport()

{

    alert("preflightReport")

    var errCnt = 0;

    myDoc = app.activeDocument;  

    var workingPreProfile = app.activeDocument.preflightOptions.preflightWorkingProfile;

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

    alert("preflightProfile" +preflightProfile.name)

    if(preflightProfile.isValid)

    {

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

        var waitProcess = preflightProcess.waitForProcess();          

        var result = preflightProcess.aggregatedResults[2];

        alert("NAME : " + myDoc.name + "\n " + result)

        if(result.length > 0)

        {

            var txtFilePath = myDoc.filePath.fsName + "/" + myDoc.name;                                                                                                              

            preflightProcess.saveReport(File(txtFilePath.replace(".indd",".txt")));

            preflightProcess.remove();

          

        }

    }

  

}

Can anyone tell me how to resolve this issue??

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 28, 2018 Mar 28, 2018

Copy link to clipboard

Copied

LATEST

Hi,

     When i run the script i am getting this result.

     "No error yet; still looking"..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines