Chapter 2. Writing macro-commands

Table of Contents

1. How commands are executed
2. A sequence of commands
3. Alternative commands
4. Testing if a command can be executed
5. The "%_" variable
6. Macro-variables
7. Simple use of named variables
8. General use of get
9. Variables mapped to the selection in XXE
10. Contextual commands

The macro-command examples you'll find in this tutorial can be tested by creating a file called customize.xxe in XXE_user_preferences_dir/addon/ (XXE_user_preferences_dir is $HOME/.xxe8/ on Linux and %APPDATA%\XMLmind\XMLEditor8\ on Windows) and binding the command to be tested to a keystroke.

Example: this customize.xxe file binds a macro-command named convertToBold to keystroke F2.

<?xml version='1.0' encoding='ISO-8859-1'?>

  <keyPressed code="F2" />
  <command name="convertToBold" />

<command name="convertToBold">
  <macro repeatable="true" undoable="true" 
         label="Convert to Bold">
      <command name="convert" 
               parameter="[implicitElement] emphasis" />
      <command name="putAttribute" parameter="role bold" />


More information about customizing XMLmind XML Editor in XMLmind XML Editor - Configuration and Deployment.

The examples used in this tutorial are found in XXE_install_dir/doc/commands/macro_tutorial/customize.xxe.