Repeat (forever)
The Repeat (forever) form of the Repeat statement is an infinite loop. The only way to exit the loop is by using an Exit statement.SYNTAX
repeat [ statement ]... end [ repeat ]wherestatement is any AppleScript statement.
This is an infinite loop; you must use an Exit statement to exit the loop
(see page 204).EXAMPLE
The following example numbers the paragraphs of a document. It uses the
Exit statement
if paragraphNum > numParagraphs then exitto exit the loop.
tell document "List" set numParagraphs to (count paragraphs) set paragraphNum to 1 repeat if paragraphNum > numParagraphs then exit set paragraph paragraphNum to (paragraphNum as string) & " " ÿ & paragraph paragraphNum set paragraphNum to paragraphNum + 1 end repeat end tell