#

## imacro

Define or print an interactive macro.

### Usage:

> imacro [window_type] key value

> > where key is a valid name for a keyboard key and value is the command to be printed to the console, pending completion. If present, window_type must be one of the window types recognized by the specialopen command: layout, color, netlist, or wind3d. If omitted, the layout window type is assumed, unless the command was called from inside a window using the colon or semicolon escape to the command-line, in which case the type of the calling window is assumed.

### Summary:

> The imacro command allows a variant of the macro command in which the bound command, rather than being immediately executed, is instead printed to the console as the beginning portion of a command, awaiting completion. It can be used to simplify typing of commands by pre-formatting the command line with the command and possibly some options. For example,

> > imacro p "paint "

> will allow the single keystroke "p" to automatically format the command "paint " on the command line, waiting for the user to enter the type to paint and execute the command.

> Unlike the macro command, commands entered by imacro are ultimately evaluated by the Tcl interpreter, and so may contain Tcl commands as well as magic commands.

### Implementation Notes:

> imacro is implemented as a built-in window command in magic.

### See Also:

> macro

Return to command index

Last updated: March 7, 2020 at 1:06pm