[jawsscripts] Re: Pause versus Delay

  • From: "Alex Stone" <alex.stone@xxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Sun, 3 Jan 2010 16:55:51 -0000

Jim, That's what I always thought it was supposed to do, but in the past it 
hasn't seemed to work the way I expected it to.
Cheers
Alex

--------------------------------------------------
From: "James Panes" <jimpanes@xxxxxxxxx>
Sent: Sunday, January 03, 2010 2:25 AM
To: <jawsscripts@xxxxxxxxxxxxx>
Subject: [jawsscripts] Re: Pause versus Delay

> The documentation is wrong. Delay () does not allow other applications to
> use cpu time. This is why you sometimes see scripts with several  Paulse 
> ()
> instead of Delay (n) where n is a number greater than 1.
> Regards,
> Jim
> jimpanes@xxxxxxxxx
> jimpanes@xxxxxxxxxxxx
> "Everything is easy when you know how."
>
> ----- Original Message ----- 
> From: "Jamal Mazrui" <empower@xxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Saturday, January 02, 2010 6:40 PM
> Subject: [jawsscripts] Re: Pause versus Delay
>
>
> Below is all the official documentation I could find on this topic,
> drawing from fsdn.chm, Basics of Scripting.chm, and the scripting guide
> by Ken Gould (published by FS).  There are some contradictions, e.g.,
> saying Pause is equivalent to a tenth of a second delay in one place,
> yet describing its behavior as clearly different in another.  I notice
> examples of using Delay after typing a keystroke, though Pause seems to
> work better for me in that situation.  Has anyone tested whether Pause
> in a While loop causes the computer to freeze up, as claimed?
> Obviously, this could happen with an infinite loop, but the
> documentation seems to be saying more than that.
>
> Jamal
>
> From FSDN.chm:
> Function: Pause
> Description
> Stops the processing of a script so that other applications can complete
> tasks. When a pause function is placed in a script, JAWS yields to the
> time needs of other applications. Once other applications have been
> given the opportunity to use processing time, then JAWS resumes the
> script. The pause function is equivalent to using the Delay function
> with a value of 1. Do not place a pause command in a While loop, because
> this will cause the computer to freeze up.
> Returns
> Type: Void
> Parameters
> No Parameters
>
> Function: Delay
> Description
> Makes a script stand still for a specified period of time. It causes a
> script to stop, wait a period of time, and then resume again. It is
> different than the Pause function which yields to the processing needs
> of applications.
> Returns
> Type: Void
> Parameters
> Param 1:
> Type: Int
> Description: Type a number to indicate the amount of time that the
> script should be delayed. The number 1 equals one-tenth of a second. The
> number 10. equals one second. Do not use numbers withdecimals, and do
> not use quotation marks.
> Include: Required
>
> Param 2:
> Type: Int
> Description: TRUE to suppress checking for and processing
> FocusChangedEvent and NewTextEvent functions before returning from the
> delay.
> Include: Optional
>
>
> From Basics of Scripting.chm:
> 10.3 Delaying Your Script
> Your scripts generally process faster than the system you are using.
> When you pass keystrokes from within your script, you may need to pause
> the script to give the system time to process the keystrokes. You can
> use one of two built-in functions to pause the processing of your script:
> Pause
> Delay
> The two functions differ in how much time they allow for the system to
> catch up with your script. The Pause function pauses the processing of
> your script so that other applications can complete tasks. The delay
> function allows you to specify the amount of time your script pauses
> before processing resumes.
> You dont have to limit the use of these functions to only scripts that
> pass keystrokes. You can use both functions in other circumstances where
> the script needs to be paused to allow for system processing.
> Knowing when to use one of these functions depends on the application
> and the PC. You may not need to pause the processing of a script to
> allow the system to catch up on a fast PC. On the other hand, a slower
> PC may require more time to process a command.
> The Pause Function
> The pause function causes JAWS to yield to the time needs of other
> applications. Once other applications have been given the opportunity to
> use processing time, then JAWS resumes processing the script.
> An example of the use of the Pause function follows:
> Example 1: Using the Pause Function
> TypeKey (alt+f) ; open the File menu
> Pause () ; allow system to open the File menu
> If MenusActive () Then; make sure the menu bar opened
> TypeKey (s) ; activate the Save option
> Else
> SayFormattedMessage (OT_ERROR, The menu bar did not open)
> EndIf
> In the above example, the TypeKey function opens the File menu. Next,
> the Pause function stops the processing of the script to give the
> application time to open the menu. Before JAWS performs the TypeKey
> function, the MenusActive function must determine if the menu bar is
> open. If the menu bar is open, then JAWS performs the TypeKey function
> and the menu item is activated. If the menu did not open successfully,
> then JAWS speaks an appropriate error message.
> The Delay Function
> The Delay function gives you more control than the Pause function when
> stopping your script. Since the Pause function relies on other system
> processes, the amount of time your script is stopped can vary. If this
> amount of time is insufficient for your script to process correctly,
> then you should use the Delay function.
> The Delay function requires a numeric value as a parameter. This value
> is a whole number that tells JAWS the length of time to pause script
> execution. This value can be a numeric value such as 5, an integer
> variable containing a value or a constant representing a numeric value.
> The amount of time JAWS pauses script execution is measured in tenths of
> a second. For example, a value of 1 tells the delay function to stop for
> a tenth of a second.
> In JAWS 5.0 and above, the Delay function accepts an optional second
> parameter. This parameter is a numeric value that tells JAWS to suppress
> checking for and processing FocusChangedEvent and NewTextEvent functions
> before returning from the delay. When you pass TRUE in this parameter,
> then JAWS suppresses any processing of the NewText or FocusChanged
> events. If you pass FALSE in this parameter, then JAWS will not suppress
> the processing of these two events. You call the Delay function using
> the following syntax:
> Delay (nDelayValue, , nNoEvents)
> An example of the use of the Delay function follows:
> Example 2: Using the Delay Function
> TypeKey (alt+f) ; open the File menu
> Delay (3); allow system to open the File menu
> If MenusActive () Then
> TypeKey (s) ; activate the Save option
> Else
> SayFormattedMessage (OT_ERROR, The menu bar did not open)
> EndIf
> In the above example, the first TypeKey function activates the File
> menu. JAWS then performs the Delay function to pause script processing
> to give the File menu time to open. The MenusActive function then
> determines if the menu is open. If it is open, then JAWS performs the
> second TypeKey function and the Save option is activated. Otherwise,
> JAWS speaks an appropriate error message.
>
>
> From "Everything You Always Wanted to Know About Writing JAWS Scripts,
> But Didn't Know Whom to Ask"
> 7.3.5.3 The Pause and Delay Functions
>
> There are two functions which will cause the processing of a script to be
> suspended temporarily, Pause () and Delay ().  This suspension of script
> processing is often necessary to prevent a script from getting too far 
> ahead
> of the application it is working with.  For example, if you use a function
> that moves the JAWS cursor to a different part of the screen or which 
> drops
> down a menu, you may have to suspend script processing to allow the
> action to
> complete before the script continues.  The Pause function simply stops
> script
> processing and gives other applications an opportunity to complete their
> processing.  Then the script resumes.  The Delay function stops for a
> specified length of time which is indicated by an integer between the
> parentheses.  The larger the integer, the longer the suspension.
> However, if
> the suspension time chosen is not adequate for other applications to
> complete
> their processing, the script will resume anyway.  Sometimes a trial and
> error
> process is necessary to determine the proper amount of delay.  In
> general, the
> Delay function is more useful when you want to force the script to stop,
> irrespective of whether the application is finished or not.  Sometimes a
> Pause
> function simply does not seem to make the script suspend for a long enough
> period, and a Delay is called for to achieve the desired affect.  In
> general,
> it's worthwhile to try the Pause first.  If more suspension time is
> required,
> a Delay can then be used.
>
> __________
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
> __________
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
> 
__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

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

Other related posts: