[jawsscripts] Re: Looping down a dynamic list

  • From: "Snowman" <snowman@xxxxxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Fri, 9 Feb 2018 11:49:05 -0600

Hmmm,  very interesting indeed.
Ah, the little VFOGroup secrets that don't get revealed.
Thanks Doug.


+--------------------------------------------------------------------------+
Listen to The Snowman on MushroomFM.com, Saturday evenings, 8PM Eastern 
time.
60's and 70's tunes, and gently conservative talk.

----- Original Message ----- 
From: "Doug Lee" <doug.lee@xxxxxxxxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Friday, February 09, 2018 1:37 AM
Subject: [jawsscripts] Re: Looping down a dynamic list


All true.

Just to complete the picture though:

For years, JAWSKey+Windows+F4 has killed and restarted JAWS from infinite 
loops, though a fair number of end users don't know about this command it 
seems.

Also, there are apparently little-known settings to adjust the timeout 
behavior you mention:

[AutoRestart]
; I believe changing this to 0 shuts off the automatic restart completely.
Enable=1
; Number of seconds to wait before forcing a JAWS restart.
Delay=30
; Whether to create a dump file on restart.
CreateDumps=1
; A sound file to play on a restart. Might have to be a .wav file.
Sound=

Warning: I have not tested those since JAWS 17.

On Thu, Feb 08, 2018 at 09:52:32PM -0600, Snowman wrote:
one cool, and sometimes annoying feature, added in more recent jaws is  a
requirement that a script exit, returning control back to the main loop in
jaws, withing a fixed period of time, something like 30 seconds.  In the
past, an infinte loop would lock up jaws completely, and the only option was
a hard restart.
But now, if your script doesn't exit within 30 seconds or so,  JAWS will
close down and then restart.
I'm not arguing against the use of safety counters.  But, if you mess up a
loop, and it turns out to be infinite, it will now get mercifully
terminated.

The  other edge, of this double edged feature, causes problems  if you
actually want to use jaws script to perform a long process.
HSC has some algorithms that due huge jobs, such as converting a large
amount of data from one form to another.  Depending on the size of your
project, those  jobs can  sometimes take long enough to aggrivate this
timeout.
We couldn't get the job done in time.  So, an alternative had to be devised.
But, anyway, you at least can get control of your computer again now, in
case your loop is not coded properly, and is not guaranteed to terminate.






+--------------------------------------------------------------------------+
Listen to The Snowman on MushroomFM.com, Saturday evenings, 8PM Eastern
time.
60's and 70's tunes, and gently conservative talk.

----- Original Message ----- 
From: "Doug Lee" <doug.lee@xxxxxxxxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Thursday, February 08, 2018 2:30 PM
Subject: [jawsscripts] Re: Looping down a dynamic list


Minor adjustment here:

The counter being used in some code samples in this thread is for safety. If
the condition for loop exit is never met, this keeps JAWS from freezing. It
is wise to use such safety counters in While loops to avoid freezes from
an infinite loop. In fact, I often call my counter "safety" :)

Such a counter should not change the operation of the loop otherwise.

On Thu, Feb 08, 2018 at 10:49:27AM -0700, Jackie McBride wrote:
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

-- 
Doug Lee, Senior Accessibility Programmer
Level Access
mailto:Doug.Lee@xxxxxxxxxxxxxxx  http://www.LevelAccess.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller
__________???

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

-- 
Doug Lee, Senior Accessibility Programmer
Level Access
mailto:Doug.Lee@xxxxxxxxxxxxxxx  http://www.LevelAccess.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller
__________�

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

Other related posts: