The [macroRef] command.
The macroRef command lets you record sequences of actions which
you can replay later. This is useful to automate some repetitive tasks.
The following kinds of actions can be recorded:
Key strokes which do not correspond to a key binding are not recorded.
- selection of a menu item;
- key bindings entered from the keyboard;
- clicks on simple toolbar items in document windows.
The formal syntax of the [macroRef] command is:
macroRef subcommand ?options?
The possible subcommands are described below. Depending on the
subcommand, some options may be specified.
The [delete] subcommand
This subcommand deletes a macro sequence designated by its token. The
complete syntax is:
macroRef delete token
Note that you can't delete a macro while it is being recorded: you must first stop
the recording, then delete it. Once a macro sequence has been deleted, its
token is no longer valid.
The [execute] subcommand
This subcommand replays a recorded sequence of actions. The complete syntax is:
macroRef execute token
If any command in the sequence fails (i-e raises an error) then the
execution of the sequence is aborted and the remaining commands are not
Note that you can't execute a macro while it is being recorded: you
must first stop the recording, then execute it.
The [isRecording] subcommand
This subcommand tells whether a sequence is currently being recorded. The
The [list] subcommand
This subcommand returns a list of the valid sequence tokens. The syntax is:
The list returned is in reverse creation order: last created sequence
The [script] subcommand
This subcommand returns a list of the recorded actions for the given
sequence. The complete syntax is:
macroRef script token
The returned value is a list of Tcl instructions corresponding to the
recorded actions. If recording is still going on, this command returns a
list of the commands recorded so far.
The [startRecording] subcommand
This subcommand starts a new sequence of actions. The syntax is:
The command returns a token which can be used with the
The [stopRecording] subcommand
This subcommand stops the recording. The syntax is:
If no sequence is being recorded, the command is just ignored.
Last updated 2016-11-23 15:54:16