Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > General

Reply
 
Thread Tools Display Modes
  #1  
Old 10-25-2019, 07:11 AM
MichelLapointe MichelLapointe is offline
Registered User
 
Join Date: Oct 2019
Posts: 8
How many open sessions ?

Bonjour,
Is there a way to quickly view the number of opened sessions ?
I open many sessions at the same time and shift-button to execute the same file transfer simulteneously from all the switches to a main storage.
If I check the main storage, I quickly see the number of new files. I want to compare it with the number of opened sessions to be sure every switches correctly did it's deed. So I'd like to compare that number with the number of opened sessions.
Merci,
Michel Lapointe
Reply With Quote
  #2  
Old 10-25-2019, 12:56 PM
ashiosee ashiosee is offline
Member
 
Join Date: Oct 2019
Posts: 24
Post

Quote:
Originally Posted by MichelLapointe View Post
Is there a way to quickly view the number of opened sessions?
That is a great question!

Currently SecureCRT does not support that functionality natively.

I have recorded a feature request on your behalf for the ability to display or view the number of opened sessions. Should a future release of SecureCRT include this feature, notification will be posted here. If you prefer direct email notification, send an email to support@vandyke.com with a subject of: "Feature Request - Forum Thread #13951".

In the mean time, there is a way to display this information via a script. Imagine having a button mapped to run the script. When pressed, the number of connected/total tabs would appear in the status bar for a brief moment.
Code:
# $language = "VBScript"
# $interface = "1.0"

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."
' Display the data to SecureCRT's status bar
crt.GetScriptTab().Session.SetStatusText strTabReport
' Wait a couple of seconds
crt.Sleep(2000)
' Clear the status bar
crt.GetScriptTab().Session.SetStatusText ""
Does this script workaround seem like it might meet your needs in the interim?
__________________
--Allen

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 10-29-2019, 09:36 AM
MichelLapointe MichelLapointe is offline
Registered User
 
Join Date: Oct 2019
Posts: 8
Bonjour Allen,
just checked the answer. Thanks for suggesting.

I'll try the script. Merci beaucoup.

by the way is there a way for me to be emailed when change is made to a thread ?

Michel
Reply With Quote
  #4  
Old 10-29-2019, 11:49 AM
ashiosee ashiosee is offline
Member
 
Join Date: Oct 2019
Posts: 24
Quote:
Originally Posted by MichelLapointe View Post
by the way is there a way for me to be emailed when change is made to a thread?
When you are signed in to the forums and viewing a thread, you should be able to click on the Thread Tools and choose to subscribe.
__________________
--Allen

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 10-29-2019, 01:12 PM
MichelLapointe MichelLapointe is offline
Registered User
 
Join Date: Oct 2019
Posts: 8
pushing my luck ...

bonjour again Allen,
thanks for the thread tools, that is done.
I am about to try the count vbs script. I'lll keep you posted.
In the meantime, I have another request that looks a bit like the "count tabs" one. I know I am pushing it, but hey ...
I am using SecureCRT to monitor let's say 50 switches displaying messages. 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

would'n that be a nice add-on ??? :-) :-) :-)
Michel
Reply With Quote
  #6  
Old 10-29-2019, 01:16 PM
MichelLapointe MichelLapointe is offline
Registered User
 
Join Date: Oct 2019
Posts: 8
it works !!!

thanks for the script. It works .
I changed the length to 5 seconds so I could find it on the screen. Great.
like we say in french
"Merci beaucoup"
Michel
Reply With Quote
  #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
  #8  
Old 10-29-2019, 06:44 PM
MichelLapointe MichelLapointe is offline
Registered User
 
Join Date: Oct 2019
Posts: 8
It works !!

This is going to help me tomorrow: I have to check 236 switches to see if the vomit set of error messages. this way I can drink coffee while seeing the tabs go by. Thanks a lot.
I long to check how many sessions I can open at once :-)
Michel

don't you think this would be a nice add-on ????
Reply With Quote
  #9  
Old 10-30-2019, 07:10 AM
MichelLapointe MichelLapointe is offline
Registered User
 
Join Date: Oct 2019
Posts: 8
by the way ...

on the "How Many Tabs" script, the display of the number of connected sessions / number of actual tabs is very useful and a nice idea. I just saw this morning that one of the 83 sessions I opened was not connected. my other technique was to scroll all the tabs using the little arrow key on the upper right.
hope this make it as a feature !
Michel
Reply With Quote
  #10  
Old 10-31-2019, 04:17 AM
bodozs bodozs is offline
Registered User
 
Join Date: Oct 2019
Posts: 2
hi guys,

it is a very useful script, thanks for sharing it!

I've checked the script with WaitForKey() call, and found that if there is a not connected window then it prints this error message:
Error: Screen.WaitForKey: not connected

I made a small modification to the script to fix this. The updated script will skip those tabs which are not connected

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.
    Set objCurTab = crt.GetTab(nCurTab)

' Switch to the tab only if it is connected
	If objCurTab.Session.Connected Then 
        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
    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
Reply With Quote
  #11  
Old 11-04-2019, 06:31 AM
MichelLapointe MichelLapointe is offline
Registered User
 
Join Date: Oct 2019
Posts: 8
another small improvement: display which tab is up, and next improvement request

Merci beaucoup bodozs,

I will try it this morning: I ran into the problem last friday, and this is a big improvement.
I have modified the following line of the original file
strTabReport = nConnected & "/" & nTotalTabs & " connected tabs."
to read
strTabReport = nCurTab & "/" & nTotalTabs & " connected tabs."

this way, I have a display at the bottom left corner of which tab I am at instead of the total number of tabs. Useful when scrolling more than a 100 tabs !
Another improvement would be this: the duration of the display. when I display 100 tab, I do a first pass at 1sec display to quickly spot problems, but after I do another at 5 sec display to read details. Now, I keep the script file open in Notepad++, change the duration
If objCurTab.Screen.WaitForKey(3) Then
and savec the file again, but having a interaction asking "how long each tab?" when the script is ran would be nice.
thanks again for the code,
Michel

Last edited by MichelLapointe; 11-04-2019 at 06:36 AM.
Reply With Quote
  #12  
Old 11-05-2019, 04:07 AM
bodozs bodozs is offline
Registered User
 
Join Date: Oct 2019
Posts: 2
Hi Michel,

I've added an input box to the script. It will as how many seconds shall the script spend on each connected tab. If no meaningful input is provided (or Cancel was selected) then 2 secs will be used as default.

I also changed the status bar message using your idea. Now it contains the current tab number and the number of connected/total tabs as well.

regards,
Zsolt

Code:
# $language = "VBScript"
# $interface = "1.0"
' Set the default wait time in seconds. Each connected tab will be displayed for this amount of time.
nWaitTime=2

' The default time can be overwritten by using this input box
sWaitTimeInput = InputBox ("Specify how long each tab should be displayed (in seconds)","Display time", nWaitTime)

' We change the default value if a meaningful number was specified
If IsNumeric (sWaitTimeInput) and not IsEmpty(sWaitTimeInput) Then
	nWaitTime = Abs (Int (sWaitTimeInput))
End If

' 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 = "Current tab: " & nCurTab & "       Connected/Total tabs: " & nConnected & "/" & nTotalTabs
    ' ###############################################################
' Now, activate the current tab and display the report:
    ' Activate the current tab.
    Set objCurTab = crt.GetTab(nCurTab)

' Switch to the tab only if it is connected
	If objCurTab.Session.Connected Then 
        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(nWaitTime) 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
    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
Reply With Quote
  #13  
Old 11-08-2019, 08:41 AM
MichelLapointe MichelLapointe is offline
Registered User
 
Join Date: Oct 2019
Posts: 8
well, that's it !

just tried it and it works perfectly

I noticed that when I stop the sequence using the spacebar and restart the script again, it picks up where it left instead of going back to the first tab, which is great ! this way, I can scan tabs at 1 sec interval, and stop using the space bar for thorough check, and start again. the bottom numbers help keeps track of the progress.

hope it gets implemented as a feature, and merci beaucoup for the programming.
Michel
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 06:15 AM.