65. recordMacro
Prev | Chapter 6. Commands written in the Java™ programming language | Next

## 65. recordMacro

Parameter syntax:

    'start'|'stop'|'toggle'|'cancel'|'view'|'get'|'replay'

This command allows to record a sequence of commands and to replay the recorded sequence at will. Used in conjunction with commands such as search and xpathSearch, this command may been seen as an advanced, versatile, yet easy to use, search/replace facility. See also command confirm.

start

  Starts recording a sequence of commands.

stop

  Stops recording the sequence of commands.

toggle

  If the recording of a sequence of commands has been started, stops this recording. Otherwise, starts recording a sequence of commands.

cancel

  Cancels the recording of a sequence of commands.

view

  Displays a dialog box containing last recorded macro in XML form. Very handy to paste it in an XXE configuration file (see XMLmind XML Editor - Configuration and Deployment).

get

  Returns a string containing last recorded macro in XML form. This option is useful to write higher-level commands and actions.

replay

  Replays recorded sequence of commands.

At most 100 commands can be recorded. Typing contiguous characters, no matter how many, counts as a single command (insertString).

Attempting to record the following commands will automatically cause macro recording to be canceled:

- any command which has been designed to be bound to a mouse click (e.g. selectAt),

- undo, redo, repeat,

- any command which fails (example: searching a string and this string is not found),

- any command which cannot be executed given current editing context (most obvious example: "`recordMacro replay`"; other example: pasting some text to a place where the schema forbids to do so).

Recording interactive command such as "insert after" works as expected: it is the command along with the element interactively chosen by the user which is recorded, and not the interactive invocation of "`insert after`" (i.e. which displays a dialog box).

Recording command execute is fully supported and works as expected: it is the command executed by `execute` which is recorded, and not `execute` itself.

Examples:

    recordMacro start
    recordMacro stop
    recordMacro replay

Prev | Up | Next
64. putAttribute | Home | 66. redo