[jawsscripts] Pause or Delay

Basically my question is when to use the pause function and when to use the
delay function.

I have an application that tracks the X Y position of the JAWS cursor and
displays its coordinates on the screen. And I have a script that moves the 
JAWS cursor and then gets that newly
written text of the X Y position. However, the new text is not
instantaneously displayed, so a delay or pause has to be inserted between
moving the cursor, and getting the text. Up to now I have been using the
delay function in the following code.

Let sTxt=GetXYText ()

JawsCursor ()

Move (iX,iY)

While sTxt==GetXyText () && i<5

Let i=i+1

Delay (1)

EndWhile

Return GetXyText ()

My question is, Would using pause be superior? My understanding is that
pause does not interfere with the applications processing, but the delay
does. Is that accurate or not? If so, would pause actually wait until the
newly written text is displayed, so that a loop would not even be needed?

Finally, I noticed that in some of the default scripts, there's a
combination of both pause and delay. For instance, in the default Script,
NextDocumentWindow, there is a delay followed by a pause. Here's the exact
code.

TypeKey (cksControlTab)

If (IsPCCursor()) Then

Pause ()

Delay(1)

If (GetObjectTypeCode ()==WT_TABCONTROL) Then

SayFocusedObject ()

EndIf

EndIf

Why is pause used, followed by a delay? Obviously, loading a new document 
window is quite different from rewriting a simple piece of text to the 
screen, but any enlightment on this matter would be appreciated.

David Pinto

__________ 
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: