uCon HomePage

Script Cmd: FKEY


FKEY [-bs]  {1-16} {label} {text | scriptname} 

FKEY [-bc]  {1-16}

FKEY [-b]  {1-16 | all} {command}

This script command allows the script to configure or interact with the function keys (2-9) or buttons (1-16).

The 'label' field is the visible text seen when the function key windows are visible.

The 'text | scriptname' field indicates what action will take place if the function key is engaged.

If a single, whitespace-delimited argument is provided after the button number argument, that is interpreted as a sub-command to FKEY. Currently, the only sub-commands supported are "enable" and "disable" to allow a script to turn off (disable) and turn on (enable) a specified button or function key.  New as of Jun 2015, "color=rrr,ggg,bbb" allows the user to set up the color of the button.   See note2 below.

Options:

-b        Indicates that the command applies to a 'button', not a 'function key'.
-c        Populute the FKEY shell variable with number of times the button or
          function key has been depressed.

-s        Indicates that the 'text' field is a script name, not raw text.

Note: If both the label and text/scriptname arguments are omitted, that tells FKEY to clear the content of the specified button or function key.

Note1: If the -c option is used, then only the first argument which specifies the button or function key number, is expected.

Note2: The ability to specify a color for the button has caused the "look-n-feel" of the button to change slightly.  When a color is active, the button will lose its 3D look.  Hopefully I'll fix this sooner or later.  By the way, specifying a color of  color=0,0,0  removes the color and restores the 3D look.

EXAMPLE1:
Use of -c option to allow a script to use a button/fkey as a means of input.

# First log the current button-3 hit count...
FKEY -bc 3
set B3HITTOT $FKEY

ECHO "Hit Button-3 to continue"

# Now wait for it to change...
# TOP:
FKEY -bc 3
if $FKEY gt $B3HITTOT goto MORE
goto TOP

# MORE:
ECHO "Got the button hit!"

EXAMPLE2:
Use of 'color=r,g,b' command to change color of function key:.

DIALOG DDLIST "Pick a color" "RED" "GREEN" "BLUE" "NONE"
IF ${DIALOG} seq RED goto GO_RED
IF ${DIALOG} seq GREEN goto GO_GREEN
IF ${DIALOG} seq BLUE goto GO_BLUE
FKEY 5 color=0,0,0
EXIT

# GO_RED:
FKEY all color=255,0,0
EXIT

# GO_GREEN:
FKEY all color=0,255,0
EXIT

# GO_BLUE:
FKEY all color=0,0,255
EXIT