[jawsscripts] Re: Looping down a dynamic list

  • From: Jonathan Cohn <jon.c.cohn@xxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Thu, 8 Feb 2018 10:46:51 -0500

A quick skim of your code did not let me know what the success condition is. 
Also, I can’t remember if JAWS has a “break” or equivalent for loops. 
Essentially what his being suggested is that you use a while that will stop 
once the condition is found or you have gone through the entire code set.

set MaxTries = 100 
for i = 1 to MaxTries 
        if AtEnd then Return Null
elif ItemFound then Return “Success”
else 
; additional processing here 
  …
EndIf
EndWhile 
SayString(“Something went wrong I tried all my attempts and never failed or 
succeeded”)

So,  you could wrap the above in its own function, or if there is an equivalent 
of the C statement “break” to prematurely end loop processing, you could 
replace the return statements with assignments then the break statement.

Essentially it is fine and even recommended that you do this type of scanning 
with a counter but that you break out of the counter once you know the answer. 
That way you avoid hanging JAWS with an infinite loop.
HTH,

Jonathan

__________�

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

Other related posts: