[jawsscripts] Re: Pause versus Delay

  • From: Andrew Hart <ahart@xxxxxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Thu, 03 May 2012 10:19:10 -0400

I can't speak for Delay, but my understanding is that Pause in JAWS
script is more or less the same as DoEvents in visual Basic, that is,
JAWS relinquishes control back to the OS.  The OS stores the JAWS
process context and gives other processes waiting in the queue and
demanding cycles some CPU time to run.  Now, there should be some
minimum amount of time betweenJAWS relinquishing control and it
regaining it again.  The point is to give the OS and other
processes/applications time to send, receive and process messages.
After this, JAWS can respond by updating the OSM and continuing to run
scripts, etc.  I imagine Jim is right about the 100 ms minimum, but that
is probably an FS-imposed constraint.  DoEvents in Visual Basic has no
such constraint because I used to use it in the main loop of game code
so that JAWS could be used to monitor on-screen activity, and the game
code was looping 50 times per second.  Thus, each loop cycle had 20 ms
to run (of which I was using about 8-12 ms) and DoEvents was only
consuming a maximum of 2 ms (and less than 1 ms most of the time).  This
was on a slower machine than what I'm running today.

However, it is interesting that a keypress kills all Delay calls in a
script.  I was never aware of that.  I often use code like

SpeechOff()
Delay(1)
Pause()
SpeechOn()

To shut JAWS up and prevent it from speaking extraneously when returning
from menus or dialogs that scripts have opened.   The Delay is
essential, for without it, the messages end up getting processed after
Pause and hence everything gets spoken.  The delay seems to allow Pause
to time to process the messages while Speech is off and before it gets
activated again, but I never truly grokked the relationship between
Delay and Pause, except that I didn't think Pause was necessarily for a
fixed time.

Cheers,
Andrew.
On 3/05/2012 8:59 AM, Doug Lee wrote:
> Interesting concept, pause() waiting for a specific number of
> messages. I do know it seems to wait for a fairly consistent amount of
> time though, so maybe it's an either-or relationship between message
> count and millisecond count?
> 
> On Thu, May 03, 2012 at 08:53:24AM -0400, Jamal Mazrui wrote:
> I forget where I got this info, but have the impression that Delay puts 
> the current thread to sleep for a prescribed time, whereas Pause waits 
> for a certain number of Window messages to be processed before 
> continuing.  Perhaps that number is 20, and perhaps those are messages 
> passed to the active window -- not sure.
> 
> Jamal
> 
> On 5/2/2012 10:26 PM, Jim Snowbarger wrote:
>> Have any of you guys ever sussed out the subtle differences between pause 
>> and delay?  I know what FSDN says about it, but that description doesn't 
>> seem particularly enlightening or precise to me.
>> What does it do behind the scenes?  Does jaws get suspended allowing other 
>> programs to run for both?  Or, just for the pause.   From the description, 
>> delay doesn't do that.  So, when you are delaying, what happens to the rest 
>> of your running applications.
>> I get the impression that they are blocked.
>> I have always modeled this jaws scrip machine in my head as a single 
>> execution thread, with  a single priority interrupt.  The main thread runs 
>> your scripts and the functions they call. the interrupts represent events.
>> I know you can run a loop containing a pause statement, waiting for an event 
>> to fire.
>> I don't know if delay allows that, or it will forestall the event.
>> Anyway, do you think that is an accurate model?
>>
>> I am poking into this because of some serious problems I am having with some 
>> custom scripts that work fine under jaws 5, and jaws 10, but have issues, as 
>> they say, with jaws 13.  More about that perhaps as I learn it.
>> But, in general, I am finding that lots of things don't work quite the same 
>> in jaws 13, and I'm having to chase down the anomalies. Great sport, isn't 
>> it?  Hunting down the latest batch of jaws quirks?  Keep your old versions 
>> handy!
>>
>> But anyway, one thing I know about these two builtins is that they behave 
>> differently if you press a key.
>>
>> For example, consider the following fragment as part of a script
>>
>> SayString ("start")
>> Let i = 20
>>
>> while (i>  0)
>>
>> ; delay(5)
>>
>> Pause()
>>
>> Let i = i-1
>>
>> EndWhile
>>
>> SayString ("stop")
>>
>>
>> Notice that delay is commented out, and pause is not.  You might want to 
>> flip that around when experimenting.
>>
>> This total loop takes 2 seconds, no matter which builtin you use, implying 
>> that Pause is also a 100 millisecond delay, which is what I always believed.
>>
>> But, one subtle difference is that delay is canceled by keyboard input.
>> Pause is not.
>> With delay, once you press a key, all calls to the delay builtin are 
>> canceled until the running script terminates.
>> This means that, if your script really needs to do the delay before it takes 
>> some other action, that action is going to be done prematurely if a key is 
>> pressed.
>> This is true in jaws 10, my favorite,  and jaws 13, and probably most if not 
>> all others.
>>
>> So what do you experts know about pause versus delay?
>>
>>
>>
>>
>> __________???
>>
>> View the list's information and change your settings at
>> //www.freelists.org/list/jawsscripts
>>
> __________???
> 
> View the list's information and change your settings at 
> //www.freelists.org/list/jawsscripts
> 


__________�

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

Other related posts: