View Single Post
  #7  
Old 10-29-2019, 05:13 PM
ashiosee ashiosee is offline
Member
 
Join Date: Oct 2019
Posts: 24
Quote:
Originally Posted by MichelLapointe View Post
thanks for the script. It works.
That's great news to hear. I'm glad the script worked for you!

Quote:
Originally Posted by MichelLapointe View Post
How about a vbs script that would circle through all the tabs, pause for 2 seconds for me to see if Something wrong, and display the next tab. And if I see something wrong, the 2 seconds display gives me time to bang the spacebar and stop the circling
You can use SecureCRT's WaitForKey() method to wait for any keystroke. Making a few modifications to the existing script to iterate over all the tabs and make use of this WaitForKey() call, you can achieve somewhat the behavior that you desire. For example:
Code:
# $language = "VBScript"
# $interface = "1.0"

' Start with the tab in which the script is launched.
nCurTab = crt.GetScriptTab().Index

Do

    ' First, prepare the "x/y Connected" report for the status bar...
    ' ###############################################################
    nTotalTabs = crt.GetTabCount
    nConnected = 0

    ' Iterate through all of the tabs, finding out how many are connected:
    For nIndex = 1 To nTotalTabs
        Set objCurTab = crt.GetTab(nIndex)
        If objCurTab.Session.Connected Then
            nConnected = nConnected + 1
        End If
    Next

    ' Compose a report of the number of connected/total tabs:
    strTabReport = nConnected & "/" & nTotalTabs & " connected tabs."
    ' ###############################################################

    ' Now, activate the current tab and display the report:
    ' Activate the current tab we're on.
    Set objCurTab = crt.GetTab(nCurTab)
    objCurTab.Activate

    ' Display the data to SecureCRT's active tab
    objCurTab.Session.SetStatusText strTabReport

    ' Now, wait a couple of seconds for any keystroke to occur
    If objCurTab.Screen.WaitForKey(2) Then
        ' Let the user know we've bailed on the script.
        objCurTab.Session.SetStatusText "Bailed due to keystroke."
        Exit Do
    Else
        ' Clear the status text on the current tab before we move
        ' on to the next tab -- this way, there isn't stale data
        ' in the status bar on tabs after this script exits/bails.
        objCurTab.Session.SetStatusText ""
    End If

    ' Otherwise, move on to the next tab.
    nCurTab = nCurTab + 1
    ' If we've gone beyond the last tab, cycle through to tab #1:
    If nCurTab > nTotalTabs Then nCurTab = 1
Loop
__________________
--Allen

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote