Editing Macros |
4.1
Macros can be edited like any WordPerfect document, but they
should be opened by clicking on Tools/Macro/Edit rather than
File/Open.
Doing so brings up the macro toolbar, which you need to save the
macro and to insert certain commands. If you open a macro as a
regular document, you can access the macro toolbar by clicking on
Tools/Macro/Macro Toolbar.
|
The macro actually consists of macro commands only. (Commands are covered in detail in the next section of the tutorial.) Inserting formatting such as tabs, hard returns, underlining, bolding, line spacing, line numbering, etc., into the macro document while you edit it will format the visual presentation of the macro file when it is opened for editing (like any WordPerfect document). However, this formatting will be ignored when the macro is compiled, and will have no effect when the macro is played. Extra spaces will also be ignored, except where they are part of a string parameter (part of text enclosed in quotation marks).
As with any WordPerfect document, you can type, delete, move
and copy text in the macro. Commands that you insert in the
macro when editing or programming must be in the exact form
required by the macro language, otherwise the commands will not
be recognized and you will get an error. WordPerfect macros are
not "case-sensitive." This means that for commands and variable names, upper- and lower-case
characters are considered identical.
Compiling a
macroDuring compilation, WordPerfect checks for any programming errors. If any are found you will receive an error message detailing the problem, and the location by phrase and line number. (It helps to turn on line numbering in long macros.) Sometimes the mistake is not readily apparent from the error message, because the problem identified by WordPerfect can be caused by a mistake earlier in the macro. A simple typo in a command, a misplaced quotation mark or semicolon, or a missing parenthesis is enough to cause a fatal error. As you gain experience editing and programming macros you will learn how to identify your errors more easily.
You can save the macro even if it does not compile, but when
you play it WordPerfect will try to compile it first, and you
will receive the same error message(s). A macro must be
successfully compiled before it can be played.
Comments To insert comments in a macro, precede the comment text with two forward slashes ("//"). When the macro is compiled everything from the two slashes to the end of the line will be ignored. Sometimes the compiler will not recognize comments unless there is a space after the two forward slashes, so it is safer to include a space; the space also makes the comment easier to read.
© 1999 Seth H. Katz
All rights reserved
E-MAIL TO AUTHOR
![]() |
![]() |
![]() |