What are Macros?

A "macro" is a way of automating tasks, particularly repetitive tasks. Multi-Edit uses two different kinds of macros. The first, known as Keystroke Macros, is simply a sequence of keystrokes that have been recorded and may be played back later. The second is much more advanced and is created using Multi-Edit's high-level CMac Macro Language. The Multi-Edit CMac Macro Language is a complete programming language, designed specifically for the automation of text manipulation tasks.

A Multi-Edit macro is a sequence of instructions that the user may save, retrieve and execute repeatedly. Unlike a simple keystroke macro, which merely repeats a series of operations already performed by the user, the CMac macro language allows for conditional action, user interface and manipulation of a variety of data types, including strings of text, integers, real numbers, and structures.

CMac is a compiled programming language similar in syntax to C. While not as sophisticated as a full-fledged, structured programming languages like C, CMac does provide:

  • if/else/else if, do/while, while, for and switch constructs
  • String, integer, character and floating point data types
  • Local and Global variables
  • String, integer, character, real and void function types
  • Parameter passing, with variable arguments and return values
  • Preprocessing directives #ifdef, #ifndef, #else, #endif, #define, #undefine
  • Complex, nested expression evaluation
  • Full access to all Multi-Edit functions
  • DLL Access Easy access to the screen, keyboard, mouse and hardware

The creation of a CMAC macro is a relatively simple process: You create the source code to the macro in a Multi-Edit window and then select Execute Compiler. Once compiled, the macro becomes immediately available for your use. You can make changes to the macro, compile again, and the changes will instantly go into effect. If you make any syntactical errors while creating or modifying the macro, Multi-Edit will display the appropriate error message and take your cursor directly to the position where the error occurred.

For additional help with the CMac Macro Language, select Help | CMAC Language or click the CMac Help button on the toolbar of any Multi-Edit Help window.

The Macro Menu contains tools for executing and debugging Multi-Edit macros. In addition, keystroke macros may be edited from this menu.