View Single Post
  #4  
Old 01-18-2012, 03:15 PM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Quote:
My goal isn't to wait for cursor movement - it is to wait for NO cursor movement. My thinking was - if the cursor has stopped moving then the host is quiet and ready for input.
Thank you for clarifying your goal and approach. I understand your thinking about waiting for the cursor to stop moving as a fairly consistent, accurate means of determining that the server is ready for input. Usually WaitForString, WaitForStrings, or ReadString will be used to wait for the command prompt on the server. The command prompt is usually an excellent indication that the host is ready for input. However, these functions do rely on screen data being synchronous (crt.Screen.Synchronous = True). The reason data should be synchronous for those functions is explained in the SecureCRT Scripting Manual, in the section 4.2 (see Avoid "Missing" Data with Screen.Synchronous = True).

If there is a lot of output and crt.Screen.Synchronous seems to be slowing down throughput to unacceptable levels, you may want to consider using an asynchronous method, as shown in the attached example script, WaitForScreenContentsToStopChanging.vbs. The script uses an approach along the lines you suggested, waiting for silence.

If you run the script from SecureCRT you'll be prompted for a timeout interval which you can set, and a command to run. After the command is issued, the script watches asynchronously for data stop changing for the duration of the timeout interval.

Once acceptable and consistent timeout periods are found, the timeout intervals could simply be hard coded into the heart of the script, which is the subroutine WaitForScreenContentsToStopChanging.

Quote:
In the past I have used Reflection which has a WaitForSilence method that worked well for this. But I'm hoping that I've missed some way in SecureCRT that I can do this.
WaitForSilence sounds like it could be useful. I'll add a feature request on your behalf for something similar to be added to SecureCRT's scripting API. As before, if implemented we'll post a follow up message here, but let us know (and refer to forum thread 10251) if you'd like e-mail notification as well, if implemented.
Attached Files
File Type: txt WaitforScreenContentsToStopChanging.txt (3.7 KB, 521 views)
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]

Last edited by jdev; 01-18-2012 at 04:17 PM.
Reply With Quote