View Single Post
  #2  
Old 01-17-2012, 06:07 PM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Hello,

I've added your suggestion for an option to wait for milliseconds instead of seconds, in WaitForCursor and WaitForStrings. We'll post here if implemented. Let us know if you would like to be notified via e-mail if implemented, and please refer to forum thread 10251.

Regarding a workaround, crt.Sleep may not the best option because it pauses script execution at that line until sleep ends. You should get better results using crt.Screen.WaitForCursor because it should return as soon as the cursor moves.

Because WaitForCursor returns as soon as the cursor moves... the granularity of time used shouldn't matter (for any scenario I can think of).

Why is a 1 second timeout too long for you?

The code example you posted loops on whether or not the cursor moved. The goal seems to be to wait for cursor movement, indefinitely. The one second timeout does not mean that the function will only return once per second. It will return immediately upon movement. In fact, depending on what else your code does, it might be better not to loop at all, and not use a timeout. It might be better to just use the maximum timeout you'd ever want to wait.

The following code demonstrates that as soon as the cursor moves the WaitForCursor method exits.
Code:
crt.Screen.WaitForCursor()
' Type a character or press the spacebar when you're ready to stop waiting
MsgBox "Cursor moved"
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote