WORDPERFECT MACRO TUTORIAL


3. Playing Macros

3.1 Playing a macro

To play a macro click on Tools/Macro/Play, or press Alt-F10. A dialog box similar to the File Open dialog will appear, listing the macros in your default macro directory or folder. Just as in the File Open dialog, you can click on the macro to play or type it in the "name" box; usually typing the name is faster. If the macro name you typed is not in the default directory, WordPerfect will try to find it in the supplemental directory. If the macro name you typed is not in either directory, you will get an error message that the file could not be found.

3.2 Save before playing a macro

It is a good precaution to save your document before you play a macro, if the macro does anything more than just inserting text. Macros will do exactly what we program them to do (like the Sorcerer's Apprentice). Unfortunately we sometimes discover after the fact that that was not what we really wanted to do! Do not depend on "undo" because if the macro uses a loop, or repetition, or chaining, you would have to go back many levels to restore your document. Get into the habit of saving a document before you play a macro, until you are sure it works as intended; that way you can recover from any mistake.

3.3 Cursor position

If you did not include any necessary step(s) to position the cursor when you recorded a macro, you will have to position the cursor manually when you play it, if the macro depends on the cursor being in a particular position in the document. This is a source of problems because you cannot depend on the user knowing or remembering to position the cursor before playing the macro. And it is a source of irritation because this is a step that should be automated, along with the rest of the macro commands. The previous instruction on cursor position bears repeating: keep in mind any cursor-position requirements when you record your macro, and include the appropriate cursor-positioning commands as the first commands in your macro.

3.4 Terminating the macro

To stop the play of a macro, press the Escape key. This has the effect of "canceling" the macro at that point. Or click on Tools/Macro, and uncheck Play on the menu. The macro will end at that point, and an informational dialog box will be displayed to the effect that macro execution has been cancelled by the user.

Short, "one-shot" macros usually run too quickly for you to be able to cancel them before they end by themselves. But you will need the Escape key to terminate macros that are paused, and especially if you have accidentally programmed an endless loop into the macro.




© 1999 Seth H. Katz
All rights reserved


E-MAIL TO AUTHOR


BACK Table of
Contents NEXT