Below is an example of a VBScript that can save you some time by automatically restoring a SecureCRT® session window as soon as output from a remote machine is detected.
Note: This tip is for use with SecureCRT for Windows®.
In the example scenario, you need to know when a build finishes so that further action can be taken right away.The VBScript below restores a hidden or minimized SecureCRT window when remote output is detected.
The build is started from a UNIX command line:
% make >& make.errs
After the command is issued, start the script below with the Script / Run menu command. When the build finishes, the cursor moves, the script detects the cursor, and the window is restored.
#$language = "VBScript"
#$interface = "1.0"
' Note: Both SecureCRT and CRT use the "crt"
application
' scripting object.
Sub Main
Do
' Wait for
the cursor to change position. This
' will indicate
activity or output from the remote.
crt.Screen.WaitForCursor
' Restore
the CRT Window associated with the
' current
session only if the window is currently
' hidden (to
the Activator) or minimized
If crt.Window.State
= 0 Or crt.Window.State = 2 Then
crt.Window.Show
1
End If
Loop
End Sub