Defining New Commands

To define a new command you use the Define Command keyword:

Define Command ApplyBoldAndItalic

Bold

Italic

End

This new command, as you might expect, will apply both Bold and Italic to the selected text whenever it is used. To use a newly defined command, just type its name as you would any other command. As an example macro, to format both the words “Mac” and “OSX” in a document:

Find All 'Mac'

ApplyBoldAndItalic

Find All 'OSX'

ApplyBoldAndItalic

Some rules about new commands:

New commands must be defined before they are used.

Names must be a single word of letters and numbers; no whitespace or symbols allowed.

New commands can only be used in the macro file that defines them (unless you use a Macro.import statement)

New commands may not use themselves (recursion is not supported).


Previous Chapter
Custom Commands
<<  index  >>
 
Next Chapter
Arguments