Looping - OCR for AnyDoc - Foundation 23.1 - Foundation 23.1 - AnyDoc - external

OCR for AnyDoc Programming Reference Guide

OCR for AnyDoc
Foundation 23.1

Looping allows you to repeat an operation until a condition is met. VBScript supports For/Next, Do/While, and Do/Until loops.

  • Use the For/Next loop when you must run a procedure a specific number of times.

  • Use the Do/While loop when you want to test a condition before you run the loop and then continue to run the loop while the condition is true.

  • Use the Do/Until loop if you want to test the condition at the beginning of the loop and then run the loop until the test condition becomes true.

A typical example of the most commonly used type of loop, the For/Next, is the following example. The procedure counts the number of lines in a zone (e.g., This), and then displays the value in a message box.

For K = 1 to This.LineCount

Zone order dictates how zone data is processed. When writing scripts for a zone that manipulates data in other zones as well, remember to account for these changes. For instance, if you write a script in zone four that deletes the data in zone ten, you must remember that the data in zone ten has been deleted.