14.3.5 Recording Macros

You can also create a macro by recording a procedure as you perform it. The keystroke sequence is saved and can be replayed, like any other macro. To record a macro:

1.Choose Set Record from the Edit menu. The Set Macro Record dialog box appears.

2.Type the name you want the macro to have in the Name text box.

3.Tab to the Key Assignment text box and press the key to which you are assigning the macro. (For example, press ALT+T to assign the macro to ALT+T. The name of the keystroke appears in the text box.) If the keystroke (such as ENTER, TAB, or ESC) would normally exit the dialog box or move to the next field, type in the keystroke's name.

4.Click the OK button.

5.Choose Record On from the Edit menu to start the recording.

6.Type the text or perform the actions you want to record. (You can select text or fields with the mouse as well as the keyboard. Mouse selections are automatically converted into equivalent keystrokes.)

7.Choose Record On again to end the recording.

You have now created a named macro available through the assigned keystroke. Pressing this key replays the actions you recorded.

WARNING:

If you do not select a name for your macro, it is assigned the default name recordvalue. Unless you plan to discard the macro when exiting, do not let a recorded macro's name default to recordvalue. Any subsequent macro recorded with the recordvalue default name will overwrite the first recordvalue macro.

A recorded macro is temporary; PWB discards it when you exit. To save a recorded macro:

1.Choose Edit Macro from the Edit menu. This opens the <RECORD> pseudofile and displays the macros you recorded.

2.Make any changes required. For example, you might want to change the macro's name or modify the keystroke sequence.

3.Save the macro using the Save command from the File menu.

The macros defined in the <RECORD> pseudofile are added to your TOOLS.INI file when you save the <RECORD> file. PWB automatically reloads them at the next session.

You can append functions to an existing macro without having to record the original steps again:

1.Choose Set Record from the Edit menu. The Set Macro Record dialog box appears.

2.Type the macro's name in the Name text box.

3.Tab to the Clear First check box and cancel selection. This causes any new actions to be appended to the original macro, rather than replacing (clearing) it.

4.Click the OK button.

5.Choose Record On from the Edit menu to start the recording.

6.Perform the actions you want added to the macro.

7.Choose Record On again to end the recording.

Remember to save the modified macro before exiting, or the new version will be discarded.

Summary: You can record a series of actions without executing them.

You can make a “silent” recording, which records a series of actions without executing them. This allows you to create a macro without altering or damaging the file. Start the recording with a meta record command (press F9, SHIFT+CTRL+R). When the macro is complete, terminate recording with record (press SHIFT+CTRL+R).

PWB gives no visual feedback during silent recording. If you need to see the macro being created, open the <RECORD> pseudofile in a second window as described above. This is an excellent way to get a better understanding of macros and editor functions.