Chapter 2. Writing macro-commands
Prev | Part I. Guide | Next

## Chapter 2. Writing macro-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/.xxe5/` on Linux and ``%APPDATA%`\XMLmind\XMLEditor5\` 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'?>
    <configuration
      xmlns="http://www.xmlmind.com/xmleditor/schema/configuration"
      xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration">

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

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

    </configuration>

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`.

Prev | Up | Next
Chapter 1. What is a command? | Home | 1. How commands are executed