APPENDIX IV
Macros in Version 7
The method of creating and using macros is totally different in version 7 of WordStar compared to the previous versions. Pressing the escape key no more brings up the Shorthand Menu. Instead, the macro menu is called from the Utilities Menu at help level 4 and by keying ^M at other help levels. In this version, the function keys are also programmed as macros.
The macro menu has seven function commands. The Play command (^MP) executes previously recorded macros. On issuing the command, a dialog box appears. You must enter the macro name or chose it from the list of macros displayed below using the arrow keys and the Enter key. Press Enter to execute the macro or click the OK button using your mouse.
You can also invoke macros using hot keys. Altogether eighty-two hot keys are available. They are the function keys F2 to F9, F11 and F12 and the function keys F1 to F12 combined with Control, Shift and Alt keys and the Alt-letter key combinations. Press the function keys or key combinations to execute the macros. WordStar comes with some pre-defined macros for some hot keys. You can use any of the available hot keys to record or create your own macro.
The option to record a macro (command: ^MR) simplifies the process of defining a macro. It works by recording all the keystrokes made by you and compiling them into a macro. Thus, you can avoid the trouble of defining the macro as a sequence of commands as with earlier versions of WordStar (See Chapter 6). However, there is still the option of creating macros by typing in the command and editing them (Command: ^MD). WordStar has evolved for this a macro language which is more complex than the procedure adopted for defining macros in earlier versions. There may not any need for you to learn this language. (If you are particular about learning it, the details can be found in the WordStar manual). For most purposes, the recording procedure will suffice.
To record a macro, press ^MR. This command will bring up the record a macro dialog box. Type in a macro name, hot-key and description. You can choose an existing macro name, if you wish, using the arrow and enter keys. The hot key and description are optional. You may choose a hot-key from the list appearing below the dialog box. If you use some of the letter key combinations such as Alt-F, the corresponding command used to activate the pull down menu at help level 4 will become unavailable. WordStar will warn you against this if you try to record a macro against such key combinations.
As soon as you exit the Record Macro dialog box by pressing enter or clicking OK, the recording of the macro begins. Every key stroke made by you after that is recorded including hits on the arrow or other special keys and any text typed in by you. This means you have to preplan the recording. The commands will have to be issued carefully with the end result in view. Commands would be recorded even if it has no effect at the time of recording. For example, a command to move to the next word would be recorded even if there is not text on the screen. But you have to be in the edit screen. It would be advisable to have suitable text on your screen so that you can watch the effect of your commands. If you correct an error, that too will be recorded. Such a macro may work all right though it will be repeating the error and correction every time it is executed. A alternative would be to stop recording and re-record the macro.
To create the dateline macro described in Chapter 6, all you have to do in version 7 would be to type in the credit line, place and then invoke the predefined date macro with the command ^M@. If you want to edit the date format, you can do that on screen. For example, if the date is inserted with the year, you can delete it and replace the coma, if any, before it with a period.
You can check the execution of the macro step by step by issuing the macro single step command, ^MS. This is useful in detecting errors (debugging). The commands in the macro are executed one by one upon your pressing the space bar. You can watch the result and look for errors. The execution will continue till the end unless an error stops execution. If you want to quit in between, press Escape or Cntrl-Break.
The other functions provided in the menu are for renaming, copying and deleting macros. The insert options in the menu list the macros for inserting date, time, and math results into the text. These are the functions we have discussed in Chapter 6. The difference here is that you have to invoke them by pressing ^M instead of the Esc key. In addition, there are macros for inserting the file name and information on the drive, directory and path with respect to the file being edited. These are usually inserted at the beginning of the text or at the end when taking print outs for reference purposes.

BACK