# XMLmind XML Editor - Online Help

### 6.5. "Record Macro" menu

You may need to enable this submenu by checking "Enable the 'Tools|Record Macro' Submenu" in Options → Preferences, General|Features section.

This menu allows to record a sequence of commands and to replay the recorded sequence at will.

This facility used in conjunction with Select → Find Element facility or with the Search tool may be seen as an advanced, versatile, yet simple to use, form of search/replace.

Start

  Starts recording a sequence of commands.

Stop

  Stops recording the sequence of commands.

Cancel

  Cancels the recording of a sequence of commands.

View

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

Replay

  Replays recorded sequence of commands.

Procedure 3.1. Procedure for recording a sequence of commands

1. Use the Start menu item.

2. Invoke commands as usual: use key bindings, menu items and tool bar buttons.

   Typing some text is of course supported. ``Tabbing'' from a text node to another is supported too.

   The following tools can also be used during a recording: Edit, Attributes, Search, Characters.

   If you use the Search tool during a recording, just use the search part; do not use the replace part. And after the searched string is found and selected, click on the Stop button of the Search tool to give keyboard focus back to the document view. This will allow you to continue adding more commands to the recorded sequence.

3. Use the Stop menu item.

Only editing commands can be recorded. That is, commands that modify the contents and/or the selection marks of the document being edited. Actions such as File → Open or View → Add cannot be recorded.

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

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

- any command triggered by a mouse click,

- 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 (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 Edit+Insert After (i.e. which activates the Edit tool or which displays the equivalent dialog box).

Recording command Execute Command is fully supported and works as expected: it is the command executed by Tools → Execute Command which is recorded, and not the invocation of Tools → Execute Command.