4 Replies Latest reply on Nov 18, 2016 1:49 AM by gkaiseril

    In JavaScript Loop Construct, Evaluating Conditional Before Iteration Throws "GeneralError: Operation failed"

    michaelw38411182

      Here is an example in a function entered in the console in Acrobat Pro 11.0.18:

       

      function loop() { console.println("\nBegin"); var i; for (i=0;i<5;i++) { console.println(i); }}

       

      This produces the following output when executed in the console:

       

      loop()

      Begin

      0

       

      GeneralError: Operation failed.

      Root.(null):1:Console undefined:Exec

      script terminated

       

      undefined

       

      The loop appears to execute once, but then throws an error when evaluating the conditional before the second iteration. I had similar results when casting the loop as a while statement, except that it failed before executing the loop even once, presumably because it had to evaluate the condition before the first iteration.

       

      This issue also arose during batch operation.

       

      Any insight?