Documentation

Buttons

Button exampleA Button is a graphical "button" that will execute a script when you click the mouse on it. This is very similar to a macro except that it is done visually with the mouse.  Buttons can be grouped into different Buttons Bars, or it can float over the main session window. Buttons can be simple push buttons (click to execute the script), or can be Toggle buttons (on or off, and clicking the button in each state can execute a different script). Buttons can also be assigned a drop-down menu of options to be selected using a Multistate button.  Graphical gauges can also be created with buttons to show a progress bar within the button frame.

The #BUTTON command can be used to define simple buttons on the screen, or to trigger a particular button. For example:

#BUTTON 1 {ls} {ls -al}

will create a button in the first position of the main button bar that has a caption of "ls" and which executes the script "look" when you click in the button. While the #BUTTON command has many different arguments for specifying button properties on the command line, it is recommended that you use the Edit Button screen in the Package Editor to change the properties of a button. The Edit Button screen makes it much easier to change the color, size, position and other visual properties interactively using a sample button shown on the editor page.

Push Buttons

The default button type is "Push".  When the button is clicked with the mouse, the script is executed.  Simple.

Toggle Buttons

A toggle button has two states: off (default) and on.  Each button state has a script.  When the button is toggled to the "on" state, the "on" script is executed.  When the button is clicked again it goes back to the "off" state and the "off" script is executed.  In the Button Options, a Variable can be assigned to the toggle button.  When the button is clicked with the mouse, the variable is set to the new state value (0 for off, 1 for on).  Or, if a script changes the value of the variable, the button state changes to reflect the new value of the variable.  If changing the variable causes the button to change states, the appropriate script is executed.

Multistate Buttons

Similar to a Toggle Button but allows more than two states.  With a Multistate button, a drop-down menu is attached to the button allowing a specific state to be selected with the mouse.  The default state gives the caption of the button when no state has been selected.  When a variable is assigned to the button, the value of the variable is associated with the state number (starting at zero).

With a Multistate button you can also specify a different mouse button or shift-key value to trigger the button state.  When these options are used, no drop-down menu item is associated with the state.  For example, you can create a multistate button that executes one script when clicked with the left mouse button, and executes a different script when clicked with the right mouse button, and yet another script when clicked with the right mouse button when the CTRL key is held down.  This allows you to create some very complex user interfaces for your session.

Gauge Buttons

A Gauge button displays a graphical progress bar within the button frame.  Options in the Button Editor allow you to set an expression (or simply a variable name) for the current value of the progress bar, the maximum value of the progress bar, and the color of the bar.  A lower threshold expression can also be defined to change the color of the progress bar when it falls below the given expression.  Gauges are still normal buttons and can still be clicked on to execute a script.

Button Captions

The Caption of a button can be a full script value containing variables and functions.  For example, to display the value of the @Ping variable on the button you could use a caption of:

Ping: @ping

Button Placement

By default, buttons are placed within the first Toolbar for the session, which appears along the top of the session window.  Four different button toolbars are available within each window.  Or you can set the Toobar value in the Button Options to zero to place the button directly over the main server output window.

Buttons are normally aligned to the left and stacked against other buttons.  You can turn off the Auto Position option and place the buttons anywhere you wish.  If you turn off the "Lock Buttons" option in the main Layout menu then you can drag/drop buttons to any position you wish using the mouse.

Button Scripting

In addition to creating and triggering buttons using the #BUTTON command, you can also control the color of a button with the %btncol function and can control the graphical icon shown on the button using the %btnimage function.

Add comment

Login or register to post comments