Gosh, There is a lot not really understood here, about the real time aspects of this. I dont' really know how windows task scheduling works. AT one time, it , maybe clear back to 3.1, was, I thought, cooperative. Once you got control of the cpu, your process kept it until it decided to relinquish it. So, a process could hog the CPU, kind of like how some people hog the conversation space? But, since they couldn't count on developers implementing their code with that in mind, I thought they went to more of a round robbin method, where processes that want time get multiplexed at a 1 millisecond rate or something. If that's the case, it may be that this distinction no longer is relevant. When one says, put the thread to sleep, that would imply, I suppose, that other processes and threads can still run. I know stuff keeps happening, even when a delay is active. For example, when I want to change focus, and then wait until it actually occurs, I don't want to wait any longer than necessary. So, instead of just waiting an arbitrary amound of time, sure to be plenty long enough for the most sluggish environment, I might take the more complicated route, and do something like this. globals int focusChangedFlag ... snip... Have FocusChangedEvent set the global FocusChangedFlag to 1 ; incidentally, I usually prefix, or postFix, my globals with some app-related letters to try to stay out of other people's name space, because globals are shared between all scripts, for all applications.. ... snip... ; focus in my window FocusChangedFlag = 0 SetFocus (myHandle) for safety = 0 to 50 Delay(1) ; or this can be a pause, either way if (FocusChangedFlag) then ; it happened Safety = 99 ;; escapes the loop endif EndFor ; chekc FocusChangedFlag and see what happened... While all these delay statements are being executed, the application is, usually, responding to the focus changed, and the JAWS FocusChangedEvent rungs, confirming that the OS gave control to the app during my loop, and that jaws events are truly asynchronous with script execution. So, I'm speculating that, other than the affect of cancelling delays due to key presses, pause and delay(1) are essentially equivalent, Concerning my comment about how delays are aborted, if you press a key, the delay calls return almost immediately, even faster in jaws 13, though I have not tick counted it. But, your loop will run to completion, which means that, if it was doing other things as well, it just did them all many times, real fast. I got into this incidentally, because I am having problems with an app that has worked wonderfully until I installed jaws 13. Now, it misbehaves on all earlier versions of jaws as well. The symptom seems to be that you can do a SetFocus in a particular circumstance, and then focus ChangedEvent will run, and GetFocus confirms that focus was placed in that window, but my tools show that the window is not visible, but is obscured by the window that had focus before this little exercise. And, insert+t says, lost focus. I have never seen that before. GetFocus says that a window which is not visible has focus, even though it certainly does not receive keyboard input. Is that normal? Even if I take the object route, sellflag_takeFocus, and all that, the same thing happens. The Control does not come into the foreground. Any ideas? AT this point, I really can't prove it's a jaws fault. I know I would need to uninstall 13 including shared components, and reinstall 10. But, I'm not quite that ambitious. <grin> Guess I don't want to know badly enough yet. Depends on whether a work around can be established. Work arounds are my life. ----- Original Message ----- From: "Andrew Hart" <ahart@xxxxxxxxxxxxx> To: <jawsscripts@xxxxxxxxxxxxx> Sent: Thursday, May 03, 2012 9:19 AM Subject: [jawsscripts] Re: Pause versus Delay 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 __________� View the list's information and change your settings at //www.freelists.org/list/jawsscripts