[jawsscripts] Re: Looping down a dynamic list

  • From: Jackie McBride <abletec@xxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Thu, 8 Feb 2018 10:49:27 -0700

Rod, what you'll want to do is something like this:
found = false
while !found
look for attribute
if attribute is found
let found = true
endwhile

Note that !found means while is not found. U can also say while found
== 0. Once found = true, the while loop will end of its own accord.
Counting numbers should not be included here--that's actually the
whole idea of a while loop. for-next loops are far better in that
latter case.

On 2/8/18, rodalcidonis@xxxxxxxxx <rodalcidonis@xxxxxxxxx> wrote:

Jonathan:

That's my error. In removing extra verbiage to get a sample code, I removed

the line where I exitted the loop.

That being said though, the issue is that unlike in AHK, JAWS does not have

a function to break out of the loop as you suggested. I have tried to loop
with a conditional statement, but because the window doesn't change, I have

gotten into an infinite loop.

I have tried to use a counter up to 100 as you suggested and that makes
things extra slow and I get random activation of other windows. This code
was after I attempted to use what Bob has suggested, though unsuccessfully
because I cannot exit out of it.

Initially I had

Icounter = 0
While Icounter < 20
Nexline()
code to get attribute
if iTakeAttributes == 1 ; the control is checked
Icounter = 20 ; exit loop I have reached my desired text
Nextline()()
Etc, etc.
Endif

Icounter = Icounter + 1

Endwhile

-----Original Message-----
From: Jonathan Cohn
Sent: Thursday, February 8, 2018 10:46 AM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Looping down a dynamic list

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

__________�

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




-- 
Remember! Friends Help Friends Be Cybersafe
Jackie McBride
Helping Cybercrime Victims 1 Person at a Time
https://brighter-vision.com
__________�

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

Other related posts: