Previous Next Chapter

KEYBOARD command

Purpose:

This command can be used to bind ARexx commands to key combinations.

Format:

KEYBOARD [NAME] <Name of key combination> ADD|REMOVE [KEY <Key combination>] [CMD <ARexx command>]

Template:

KEYBOARD NAME/A,ADD/S,REMOVE/S,KEY,CMD/F

Parameters:

NAME

Name of the key combination to add or remove. Each key combination must have a name with which it is associated. The name must be unique.

ADD

This tells the KEYBOARD command to add a new keyboard combination. You will also need to specify the KEY and CMD parameters.

REMOVE

This tells the KEYBOARD command to remove an existing keyboard combination.

KEY

The keyboard combination to add; this must be in the same format as used by the Commodities programs.

CMD

This is the ARexx command to bind to the keyboard combination. The command can either be the name of an ARexx script to execute or a short ARexx program in a single line.

Errors:

10 - The command will fail if you tried to add a duplicate of an existing key combination or if the key combination to remove does not exist. The error code will be placed in the WORKBENCH.LASTERROR variable.

Result:

-

Example:

/* Bind an ARexx script to the [Control]+A key combination. * When pressed, this will cause the ARexx script by the name * test.wb" to be executed. ARexx will search for that program * in the REXX:" directory. If no test.wb" file can * be found, ARexx will attempt to execute a script * by the name of test.rexx". */

ADDRESS workbench

KEYBOARD ADD NAME test1 KEY ,"ctrl a", CMD ,test`

/* Bind an ARexx script to the [Alt]+[F1] key combination. * When pressed, this will cause a short inline program to be * executed. */
KEYBOARD ADD NAME test2 KEY ,"alt f1", CMD `say 42"

/* Bind an ARexx script to the [Shift]+[Help] key combination. * When pressed, this will cause the Workbench About" menu item * to be invoked. */
KEYBOARD ADD NAME test3 KEY ,"shift help", CMD `MENU INVOKE WORKBENCH.ABOUT"

/* Remove the first key combination we added above. */
KEYBOARD REMOVE NAME test1

Top Previous Next Chapter