VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Example: Ping Host from Selection/Clipboard Using Local Shell Connection (https://forums.vandyke.com/showthread.php?t=14248)

jdev 08-03-2020 01:08 PM

Example: Ping Host from Selection/Clipboard Using Local Shell Connection
 
1 Attachment(s)
This example script shows how to utilize the "Local Shell" capability of SecureCRT to launch a local 'ping' command for any of the following (in order of precedence):
  1. currently in clipboard, or
  2. currently selected in the terminal window (if the clipboard is empty), or
  3. specified by the individual when prompted (if neither the clipboard nor the selection matches the pattern of a valid host name or IP address).

Download the example script here:
PingHostFromClipboardOrSelection(LocalShell).py.txt

Note: This script requires a version of SecureCRT that supports the Local Shell protocol and will only work on an OS that supports Local Shell connectivity (e.g.: Linux, macOS, and Windows 10 Version 1809 and newer)
Code:

#  Last Modified:
#    04 Aug, 2020
#      - If a "Ping" tab already exists, activate and use
#        that tab instead of opening a new tab.
#      - If a tab already exists that was connected with
#        the saved session named with the value of the
#        strLocalShellSessName variable, activate and use
#        that tab instead of opening a new tab.
#
#    30 Jul, 2020
#      - Initial revision

--Jake


All times are GMT -6. The time now is 06:26 PM.