1 Reply Latest reply on Jan 27, 2014 12:07 PM by NateO12

    Problem with 'Process Preflight Profile Show Errors' Adobe script

    NateO12

      Hi everyone,

      I'm trying to use the preflight tool as a simple check for missing graphics. My other method involved checking every link to see if it was missing, but that was taking too long.

       

      The Adobe script 'ProcessPreflightProfileShowErrors.jsx' is what I'm using to start. I have duplicated the [Basic] preflight profile, and named it 'Test'. All my document has on it is one graphic that is linked properly. However, when I step through the script, it kicks me into the error if statement, despite not having any errors at all. Here is the relevant code:

       // Assume there is a document.
       var myDoc = app.documents.item(0);
       // Assume the Test preflight profile exists.
       var myProfile = app.preflightProfiles.itemByName("Test");
       //Process the myDoc with the rule
       var myProcess = app.preflightProcesses.add(myDoc, myProfile);
       myProcess.waitForProcess();
       var myResults = myProcess.processResults;
       //<fragment>
       //If Errors were found
       if (myResults != "None")
       {
        // array containing detailed results
        var errors = myProcess.aggregatedResults
        // Show the errors in a message box.
        var str = "Document: " + errors[0] + ", Profile: " + errors[1] + ", Results: ["
        var errorResults = errors[2]
        for (var i = 0; i < errorResults.length; i++)
        {
         if (i > 1)
         {
          str += ", "
         }
         str += errorResults[i][1]
        }
        str = str + "]"
        alert(str)
       }
      
      

       

      The 'if errors were found' logic seems to be working opposite to what I've seen previously. If I run the script with no missing graphics, it kicks me into the error if statement, even though at the end of the script it reports no errors. If I make the graphic missing, it still kicks me into the error if statement, like it should. If I have no missing graphics but change != to ==, it should kick me into the "error" if statement, but it doesn't. Am I just totally confused on how this works, or is there maybe something I'm going wrong? I'm using CS6 on Windows 7. Thanks for any help, this is driving me crazy.