Write Macros for the Editor

You may want to write an editor macro to customize aspects of the Source view or the Editor window, and to automate lengthy or frequently used sequences of commands.

Macros are written using a combination of REXX commands and Editor commands and parameters. Macros used by the Editor, along with other example macros, can be found in the macros directory. You can use these system macros as a guide when creating your own macros, as follows:

  1. Decide on a name for the macro, according to its purpose:
  2. Create a new text file.
  3. Place the commands you want to issue in the text file.

    The first line of the macro must start with a comment. Comments begin with /* and end with the */ symbols. Editor commands within the macro must be enclosed in single or double quotation marks. If you need to extract information from the Editor, use the extract command.

  4. Save the file.
  5. Ensure that the file is in a directory listed in the LPATH4 or CPPLPATH4 environment variable.
Note: Unless you issue a sshow command, the Editor does not refresh information displayed in the Source view or the Editor window until after a macro finishes running.

See the repeats sample macro for a detailed example of how to create a macro.



Macros and Profiles


repeats sample macro