macro [char [string]]
macro [key [value]]
where key is the name of a valid key (see below), and value is a magic command-line command.
The macro command translates keystrokes typed into a layout window into magic command-line commands. When the key key is pressed in a layout window, the command stored in value is executed relative to that layout window. The default bindings are specified in the system .magic file, read at startup. These macros may be arbitrarily rebound using the macro command.A key macro may be unbound from a command by passing an empty string ("") for the value.
key is any valid name for a keyboard keypress event. In its simplest form, this may just be the name of the key, such as "g" or "X". The space bar key must be quoted in double-quotes; most other characters may be unquoted. Control characters may be specified by the two-character combination of the carat ("^") key followed by a capital letter, such as "^Z". The use of embedded control characters is deprecated, as it is incompatible with Tcl syntax.
key may also be specified as any valid X11 name for a key as defined in the include file keysymdef.h on UNIX systems. This allows specification of function keys such as "XK_F8" or keypad keys such as "XK_KP_Right".
Finally, key modifiers may be prepended to the key name. Valid key modifiers are Shift_, Control_, Alt_, and Meta_, and may be coupled in any combination.
macro is implemented as a built-in command in magic. In cases where it is desired to call Tcl procedures within the macro function, the Tcl script procedure gmacro should be used instead of macro.
gmacro
imacro
Return to command index |
Last updated: October, 2004