SUPPORT > TIPS
Send us a question or comment

   

Using the SecureCRT® button bar to run scripts, commands, and launch programs

The SecureCRT button bar (version 6.0 and later) is quick to configure and saves thousands of keystrokes in daily use. The button bar runs along the bottom or top of the session window and allows buttons to be mapped to a range of commands: you can send strings, run scripts, invoke menu functions, issue protocol commands, and more. The button bar is an option that you can turn on and off like the toolbar or status bar. You can create multiple button bars, which allows you to define and use custom commands for a particular session or environment.

The SecureCRT button bar

This tip provides step-by-step instructions for configuring the button bar. There are eight types of functions that can attach to a button command, but we will focus on buttons for these key command types: Send String, Menu Function, SSH Function, Run Script, and Launch Application. After the buttons are configured, you can click on buttons whenever you need them.

Note: you do not need an active connection to create button commands and see the button bar change, but to run Send String, Scrollbar, Telnet, VT, SSH, or Run Script commands successfully, you will need an active session for the commands to interact with.

If the button bar is not visible, click on the View / Button Bar menu command. Once the button bar is visible, right-click anywhere on the button bar to bring up the Map Button dialog with all the options.

Create a button command to send a string in a session

  1. Right-click on an empty area of the button bar and select New Button... to bring up the Map Button dialog.

  2. Select Send String, the first choice on the Function drop-down. Type in a command to send to the remote machine. For UNIX/Linux, it could be something like the following sequence of commands that would recursively change owner and group for the current directory and all sub-folders and files to <owner_of_current_folder>users, as well as change file permissions recursively on the same files to 750:

    chown -R `ls -dl . | awk -F\  '{print $3}'`:users .?* *\nchmod -R 750 . ?* *\n

  3. Enter a label that will display on your button and click OK to install the button on the button bar.

Map button to send a string

Create a button command for a menu command

  1. Right-click on an empty area of the button bar and select New Button... to bring up the Map Button dialog.
  2. Choose Menu Function from the Function drop-down list, and then select a function from the center list, like MENU_TAB_CLONE.
  3. Enter a button label and Click OK.

Map button to a menu function

Create a button command for an SSH Function

  1. Right-click on an empty area of the button bar and select New Button... to bring up the Map Button dialog.
  2. Choose SSH Function from the Function drop-down list, then select SSH_FLUSH_AGENT.
  3. Enter a button label and click OK.

Map button to an SSH function

 

Create a button command to run a script

The Run Script command lets you employ a powerful script in VisualBasic, Jscript, Python, or other scripting language, with full access to the SecureCRT interface and shell functionality. SecureCRT 6.6 and later allows arguments to be passed to the script being launched. If you don't have scripts of your own, first download a script from the Support Scripting FAQ section on the VanDyke Software website to your local SecureCRT Scripts folder – or you can choose one of the three sample scripts installed with SecureCRT for Windows. Then you will attach the script to a SecureCRT button command.

  1. Download a script from Example Scripts for Windows (we suggest SendData.vbs or SendFile.vbs)or Example Python Scripts for Windows, Mac, and Linux.
  2. Save the file to a local folder.

Now you are ready to map the script to a button.

  1. Right-click on an empty area of the button bar and select New Button... to bring up the Map Button dialog.
  2. Choose Run Script from the Function drop-down list.
  3. Click on the center Browse '...' file selector button and navigate to your script file. Click Open.
  4. Enter a button label and click OK.

Map button to run a script

Create a button command to launch an application

Because computer professionals often use several programs to accomplish a task, firing up an application quickly without navigating menus is highly valuable. In SecureCRT 6.0 and later, you can launch external programs, either from the button bar or from a mapped keystroke.

  1. Right-click on an empty area of the button bar and select New Button... to bring up the Map Button dialog.
  2. Choose Launch Application from the Function list.
  3. Click on the center Browse '...' file selector and navigate to the desired application file (for example, Regedit.exe in the Windows directory). Click Open.
  4. Enter a button label and click OK.

Map button to launch an application

To learn more about the button bar and the other functions that can be mapped to button commands, see the Using the Software / Getting to Know the Window / The Button Bar topic in the SecureCRT program Help files.

Was this information helpful?
Yes No
Thank you!
Send your comments and questions to VanDyke Software Support,
or join the discussion in the VanDyke Software Forums.
Can't find the answer you're looking for?
Ask VanDyke Software Support directly
and we will get back to you as soon as possible.
1.  Read or download one of our secure solutions white papers. 2.  Download a free
30-day evaluation copy of our products.
3.  Let us help define the right Secure Shell solution for your company. 4.  Subscribe to our What's New page for tips, solution ideas, and product news.