Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Works fine for me...
Copy link to clipboard
Copied
You might try including a "return" to terminate your function.
Copy link to clipboard
Copied
No problem with this function.
Copy link to clipboard
Copied
Do you have a form open or created a JavaScript object eith a name of "loop".
Give your function a different name.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now