7 Replies Latest reply on Sep 18, 2013 8:50 AM by 7 GRAD PLUS

    Preflight question

    Jan.vs

      Hi all,

       

      I have a javascript for preflighting a document. It works fine, but I would like to add the possibility to only check some pages in the document.

       

       

       

      var myprocess = app.preflightProcesses.add(doc, profile);

      myprocess.waitForProcess();

      var results = myprocess.processResults;

      myprocess.saveReport(File(myPrefsFolder+"/Errors.txt"), false);

       

      best regards,

       

      Jan.

        • 1. Re: Preflight question
          [Jongware] Most Valuable Participant

          Check app.activeDocument.preflightOptions, this has a preflightScope parameter.

          • 2. Re: Preflight question
            Jan.vs Level 1

            Hi Jongware, thanks for your reply,

             

            I've added

             

                 var MyOptions = app.activeDocument.preflightOptions

                 MyOptions.preflightScope ="1-2"

                 MyOptions.preflightWhichLayers = PreflightLayerOptions.PREFLIGHT_VISIBLE_LAYERS

             

                 var myprocess = app.preflightProcesses.add(doc, profile);

                 myprocess.waitForProcess();

                 var results = myprocess.processResults;

                 myprocess.saveReport(File(myPrefsFolder+"/Errors.txt"), false);

             

            to my script, but it keeps preflighting all pages. What am I doing wrong?

             

            Jan.

             

             

            • 3. Re: Preflight question
              John Hawkinson Level 5

              (Speculation)

              I don't think you are obtaining a reference to the options, but rather a copy of them.

              So try adding:


              app.activeDocument.preflightOptions = myOptions;

               

              after your 3rd line. Also, please use semicolons in Javascript. The interpreter will insert them when you omit them, as here, but you will find this silently masks some classes of errors.

              • 4. Re: Preflight question
                Jan.vs Level 1

                Hi Jongware,

                 

                Still no luck with the preflight options. The preflight on the document is performed OK, but the text file containing the report holds the info for all pages. It seems like the script sets the prefs for the preflight on the document(I can see in the preflightpanel that the options are altered), but the process (myprocess in the script) doesn't take the options to perform the preflight.

                I've tried to add the options to the PreflightProcesses.add but got an error there.

                 

                var myErrorProfile = "TestProfile";

                var doc = app.activeDocument;

                 

                var myOptions = app.activeDocument.preflightOptions;

                     myOptions.preflightScope ="1";

                 

                // Perform the preflight with the error profile

                var profile = app.preflightProfiles.item(myErrorProfile);

                var myprocess = app.preflightProcesses.add(doc, profile,myOptions);

                myprocess.waitForProcess();

                var results = myprocess.processResults;

                myprocess.saveReport(File("~/Desktop/Errors.txt"), false);

                if (results.substring(0,4) !="None"){

                myErrors ++

                }

                myprocess.remove();

                • 5. Re: Preflight question
                  John Hawkinson Level 5

                  It sounds like you're not going to succeed here.

                   

                  This also gives a similar result:

                   

                  var myprocess = app.preflightProcesses.add(doc, profile, undefined, { preflightScope: "1"});

                   

                  You could traverse the aggregatedResults yourself and only extract the page you want...or you could copy the page to another document...neither are great solutions.

                  • 6. Re: Preflight question
                    Ville Järvensivu

                    Hi, I just filed a bug report considering preflightScope not giving any effect for app.preflightProcess

                    • 7. Re: Preflight question
                      7 GRAD PLUS

                      Was there any effect to the bug report!?

                       

                      thanks in advance!