Automating repetitive tasks by recording macros

Let's suppose that in a poorly-tagged document, you want to replace dozens of literal elements containing word "XXE" by the equivalent abbrev elements. How would you do that using XMLmind XML Editor, given the fact that this application only has a text search/replace facility?

The answer is: perform the editing operation only once as you would do it normally, but make sure to record your actions using the ToolsRecord Macro facility.

The Tools|Record Macro submenu

After the macro —that is, the sequence of commands you have invoked— has been recorded, it becomes possible to “replay” this macro as many times as needed to.

In the case of the above example, the sequence of commands to be recorded is:

  1. Find next occurrence of a literal element containing word "XXE" using SearchFind Element (Esc f, f like find).
    The Search|Find Element dialog box
  2. Use The 'Convert' icon EditConvert (Ctrl-T) to convert the literal element to an abbrev element.
  3. Press Tab to move the caret outside the abbrev element.

Once the macro has been recorded, you'll have to invoke it repeatedly until all the occurrences of literal element containing word "XXE" have been replaced by abbrev elements. This can be done by pressing Esc p (p like play), which is quicker than selecting menu item ToolsRecord MacroReplay Macro.

While recording a macro, you can use, not only keyboard shortcuts, but also any part of the user interface of XMLmind XML Editor: menu item, toolbar button, right-side pane, etc. This means that you can work almost normally while you are recording macro. There are notable exceptions though. Using any of the following commands will automatically cancel the recording of the macro: Undo, Redo, Repeat and any command bound to a mouse click (for example, double-click to select a word).

Also note that commands such as FileSave are simply not recorded because such commands do not contribute in modifying the document.

Screencast Watch the screencast

Keyboard shortcuts

While it's certainly possible to click on menu items, toolbar buttons, etc, while recording a macro, this facility is meant to be used with the keyboard alone.

Keyboard Shortcut Description
Esc m (m like macro) Start/stop recording a macro.
Esc q (q like quit) Cancel the recording.
Esc p (p like play) Execute (“replay”) the macro.
Esc f (f like find) Find element.
Esc s (s like search) Find some text.

Displays a simple text search dialog box (see below) which is more convenient to use in the context of macro recording than the Search right-side pane.

Esc x (x like execute) Execute a command by specifying its name and its parameter. Example: execute command "selectText" with parameter "word".

The ToolsExecute Command dialog box (see below) is useful when there is no other way to execute a command, for example, when the command has no keyboard binding or when the command only has a mouse binding. (Remember that using your mouse inside the document view will cancel the recording of the macro.)

The commands which can be executed this way are all documented in XMLmind XML Editor - Commands.

The simple text search dialog box

The simple text search dialog box
The ToolsExecute Command dialog box

The Tools|Execute Command dialog box

Related productivity tips

related productivity tip Custom keyboard shortcuts