3 Replies Latest reply on Dec 30, 2009 9:45 PM by A T Jones

    [CS4 JS] Live Preflight

    Skempy Level 1

      Hi,

       

      The following is part of script which checks to see if there are any errors in the Live Preflight before continuing with a PDF export.

       

      var myPreflight = app.preflightProcesses[0];
      var myReport = myPreflight.processResults;
      myReport = myReport.replace(/\s+$/,"");
      if (myReport == "None")
      {...

       

      My problem is that this script doesn't distinguish between the Preflight for the current document and that for any other document that may be open. I assume it is using the FIRST Preflight process created which will not always be for the current document.

       

      Is there a way to reference the Preflight for the current document only? Searching for "Preflight" in the Object Model Viewer in ExtendScript Toolkit bring up No Results.

       

      Thanks,

       

      Skempy

        • 1. Re: [CS4 JS] Live Preflight
          AdobeScripts Level 3

          var myPreflight = app.preflightProcesses[0];
          var myReport = myPreflight.processResults;
          myReport = myReport.replace(/\s+$/,"");
          if (myReport == "None")
          {...

           

          My problem is that this script doesn't distinguish between the Preflight for the current document and that for any other document that may be open. I assume it is using the FIRST Preflight process created which will not always be for the current document.

           

          Is there a way to reference the Preflight for the current document only? Searching for "Preflight" in the Object Model Viewer in ExtendScript Toolkit bring up No Results.

           

          maybe you should check this "array":

           

          Property AggregatedResults As Variant
              read-only
              Member of InDesign.PreflightProcess
              The aggregated results found by the process. Type: Ordered array containing DocumentName:String, ProfileName:String, Results:Array of Ordered array containing ParentNodeID:Long Integer, ErrorName:String, PageNumber:String, ErrorInfo:String, ErrorDetail:Array of Ordered array containing Label:String, Description:String

           

          or maybe you should set PreflightScope - to your Document - in PreflightOptions:

           

          Property PreflightScope As Variant
              Member of InDesign.PreflightOption
              The pages or documents to preflight, specified either as an enumeration or a string. To specify a range, separate page numbers in the string with a hyphen (-). To specify separate pages, separate page numbers in the string with a comma (,). Type: idPreflightScopeOptions enumerator or String

           

          robin

           

          www.adobescripts.co.uk

          • 2. Re: [CS4 JS] Live Preflight
            Skempy Level 1

            Thanks Robert,

             

            I have now found the Preflight classes in the EST Object Model Viewer, I was searching under Adobe InDesign CS4 (3.0) not (6.0) !

             

            I hope I can now make sense of the info...

             

             

             

             

            Simon.

            • 3. Re: [CS4 JS] Live Preflight
              A T Jones

              Here's a sample function that returns true if the active document passes live preflight, and returns false if it has failed live preflight for some reason.

               

              Function CheckPreflight() 'As Boolean

                'oID is created elsewhere, it is the InDesign.Application object
                Dim p 'As InDesign.PreflightProcess
                For Each p In oID.PreflightProcesses
                  If p.AggregatedResults(0) = oID.ActiveDocument.Name Then
                    CheckPreflight = (Left(p.ProcessResults, 4) = "None")
                    Exit Function
                  End If
                Next
              End Function