Chapter 1

MACRO PRIMER

Imagine turning on a tape recorder in your computer to memorize everything you do on the keyboard. Press a series of keys to save a document on your hard disk, for example, and the computer remembers each key you pressed. Play back the recording, and the computer mimics your actions. That's the idea behind WordPerfect macros -- memorizing your keystrokes and playing them back at the touch of a button. Of course, macros go way beyond this simple definition. You will learn all about macros, and the various functions they can perform, throughout the course of this book.

For the sake of simplicity, WordPerfect macros can be divided into two categories:

In this chapter, you'll learn what keyboard recorded macros are and how they are used. This chapter serves as an introduction only; more advanced macros techniques are covered in the following chapters.

 

WHEN TO USE MACROS

You can use macros for a wide variety of tasks. The way you use macros will depend on your application, and how often you do the same types of jobs. In any case, macros are used to simplify WordPerfect and cut down on the amount of typing you do. You can define a macro to perform any task you would normally perform with WordPerfect, but you should reserve macros for only those chores that you do on a fairly regular basis.

As a rule of thumb, you don't need the macro if it isn't used more once or twice a week (assuming you sit behind the computer every day). Unless the series of keystrokes is very long and involved, you're better off manually tapping it out on the keyboard. Some exceptions to this "rule" apply, however, particularly if WordPerfect is used by persons with little or no computer training.

Using macros falls into four distinct categories:

Let's take a closer look at each category and examine the special relationship each has with WordPerfect macros.


To Automate Command Key Sequences

WordPerfect employs a complex structure of menus, commands and options using the computer's function keys. Some of the commands, such as underlining, document saving, and spelling, provide only one or two options and their simplicity does not require macros.

Other commands, however, have several layers of menus and using them requires you to choose the functions you want from a list that appears on the screen. If you find yourself choosing the same commands and options time and time again, you can automate the process by recording the keys as a macro.


To Memorize Passages Of Commonly Used Text

One common use of WordPerfect macros is memorizing passages of text for later playback. Instead of tapping out "WordPerfect" each time you write it, you record it as a macro and recall it at touch of a key. You can do the same thing with other text entries, including your name and address, telephone number, company name, and common phrases such as "Sincerely," "I look forward to your prompt reply" and "You just won $10,000 in our 'Welcome to the Neighborhood' sweepstakes!"

The length of the passage of text is unlimited -- although very long text blocks are better saved as a merge document. You can use macros to store "boilerplate" text for use in contracts, legal briefs, reply letters, and other documents. Instead of typing commonly used words and phrases, you record the text as a macro and insert them in your documents at any point you desire. Boilerplating allows you to customize your documents while saving time and effort.

An often overlooked advantaged of using macros to store frequently used text is that, because the characters are stored on disk in the exact form that you typed them, your accuracy and spelling improves. It's easy to overlook typographical errors in the return address, salutation, or closing of a letter. And imagine how embarrassing it is to end your letter "Sincereky, Rogerr Smth," instead of the proper "Sincerely, Roger Smith." Of course, the spelling checker built inside WordPerfect may catch some or all of these errors, but you may forget to check the letter before mailing it out. Perhaps a more serious error is entering the wrong return address, social security number, or phone number, items that the spelling checker does not review.


To Simplify a Series Of Formatting Instructions

WordPerfect's default format settings are useful for routine letter writing, but for more advanced documents you need to alter the format characteristics. Every element of appearance of WordPerfect documents is controlled by one or more of the computer's function keys. To change the margins, for example, you press:

[Shift]-[F8]
Option 2
Option 7

You then enter the desired right and left margins. Depending on the margin settings you want, this operation requires a minimum of 10 keystrokes (including pressing the [Enter] key to accept the changes and return from the menus).

Granted, the keystrokes necessary to change the margin settings are not overly complicated, so if you modify the margins only occasionally, you can continue to plunk away manually at the keyboard. But if you find yourself frequently switching between common margin settings, you'll save a great deal of time by encoding the changes as a set of macros. With standard margin settings stored as a macro, you can reduce the number of keystrokes to two -- the [Alt] key and a single letter.

Some document types require you to constantly change the margins. If you are writing movie scripts, for example, you need different margin and tab settings for dialog and action sections. In the typical one hour TV script, you may change margins two or three hundred times. That equates to two or three thousand keystrokes that never appear in your script, and aren't likely to help win you that Emmy award. By recording the various margins as macros, you can quickly recall the proper settings by pressing just a few keys.


To Program WordPerfect For Use By Others

Not everyone is a whiz at WordPerfect. If others in your office use WordPerfect, and they have little or no experience with it, you can program the software with macros to make it easier to use. A good example is creating and printing a mailing list. Normally, this requires fairly in-depth knowledge of WordPerfect. But by creative use of macros, you can program the software to prompt the user for the desired information and nearly automate the entire process.

Even if you or others in your office are familiar with Wordperfect, macros can be used to simplify complicated tasks, particularly those that you may not often do. The macro stores all of the commands needed to complete a procedure, so you don't have to remember which buttons to press. You can create a menu such as this one for any WordPerfect job you need done.

 

BASIC STEPS

There are five basic steps to defining a macro.

While defining a macro, WordPerfect will execute your commands. This helps you better follow the course of the macro, but you may also inadvertently change your document in way you don't want. You can create macros without disturbing current work by switching to Doc 2 (press the Switch key). After you complete the macro, switch back to the main document or close Doc 2 (press Exit, N, N.)

 

TYPES OF MACROS

WordPerfect creates four types of macros:

 

Alt-key Macro

WordPerfect can store up to 26 Alt-key macro definitions -- one for each letter key. They are termed Alt-key macros because of the way they are recalled: you press the [Alt] key and a letter key.

To define an Alt-key macro:

Key Sequence What it does
1. [Ctrl]-[F10] Starts macro recording.
2. [Alt]-{key} Names macro with Alt-key combination (such as [Alt]-A or [Alt]-F).
3. {description}
[Enter]
Describes the macro.
4. {macro steps} Defines the steps of the macro (enter keystrokes to be recorded here).
5. [Ctrl]-[F10] Stops macro recording; saves macro file on current default disk.

To replay an Alt-key macro, press the [Alt] key and the desired letter key simultaneously. For example, if you recorded a macro that changes the right margin from 74 to 55 as [Alt]-M, depress the [Alt] and M keys together.

Alt-key macros are stored on disk and can be accessed any time, even during subsequent sessions with WordPerfect, regardless of the document you are editing (with some word processors, macros are tied to the current document). Alt-key macro files can be copied, deleted, and manipulated like any other WordPerfect file.

WordPerfect automatically names the Alt-key macro file for you. You can easily identify Alt-key macro files by their name and .WPM extension (macros made with version 4.2 of WordPerfect, which cannot be used in version 5.1 without conversion, have the extension .MAC). The name is always "ALT" plus a single letter key. WPM FILES)

Examples:

ALTA.WPM -- for the [Alt] and A key combination.

ALTD.WPM -- for the [Alt] and D key combination.


Named Macro

The Alt-key macros are the easiest to use because you can replay them by pressing just two keys (the [Alt] key and a letter key). You should record the most common procedures as Alt-key macros. But any serious WordPerfect user will quickly run out of Alt-key combinations. As an alternative, you can save macros under a name you provide. Once saved, you recall the macro by pressing [Alt]-[F10], the Macro key, then entering the name of the macro you want.

To define a named macro:

Key Sequence What it does
1. [Ctrl]-[F10] Starts macro recording.
2. {name}
[Enter]
Names macro using any name with two to eight characters.
3. {description}
[Name]
Describes macro.
4. {macro steps} Defines the steps of the macro (enter keystrokes to be recorded here).
5. [Ctrl]-[F10] Stops macro recording; saves macro file on disk.

To replay a named macro:

Key Sequence What it does
1. [Alt]-[F10] Execute play back macro command.
2. {name} Defines name of macro to use.
3. [Enter] Initiates macro playback.

As with Alt-letter macros, named macro files can be identified by their .WPM extension.

Examples:

SALUTE.WPM -- for a salutation macro for use at the start of letters.

LET-HEAD.WPM -- for a letterhead macro.

MERGE.WPM -- for a merge print macro.

Macro naming conventions are the same as with DOS files. Macro names may contain from one to eight characters. You may use any combination of letters or numbers in the file name as well as most symbols except the following:


Remapped-key Macros

WordPerfect allows you to reassign (or "remap") nearly every key on the keyboard. For example, you can change the standard "QWERTY" keyboard layout to the Dvorak layout by re-identifying the alphabet keys. The re-assigned keys may include multiple keystrokes. For instance, the [Shift]-[F7] key, which normally calls up the print menu, might be re-mapped to call up the Print menu, select the Draft Quality option, then print the entire document. In this way, the remapped keys behave like macros. In fact, you edit and program the keys the same way as you do macros.

Keyboard remapping uses the keyboard layout option in the Setup menu. The exact procedure for key remapping, which is an advanced topic, is detailed in Chapter 7.


Temporary Macro

Not all macros need to be stored for future use. You may have occasion to create a temporary macro that you use for the current writing and editing session only. The advantage of a temporary macro is that you won't clutter up your disks with a macro you may create and use only on one special occasion.

WordPerfect 4.2 allowed you to make up to 27 temporary macros, but version 5.1 permits only one. Temporary macros are assembled in nearly the same manner as permanent Alt-key macros.

To define a temporary macro:

Key Sequence What it does
1. [Ctrl]-[F10] Starts macro recording.
2. [Enter] Creates temporary macro.
3. {macro steps} Defines the steps of the macro (enter keystrokes to be recorded here).
4. [Ctrl]-[F10] Stops macro recording; saves macro file on disk.

To play back the temporary macro:

Key Sequence What it does
1. [Alt]-[F10] Invoke play back macro command.
2. [Enter] Defines name of macro to use.

While the [Enter]-key macro is technically "temporary," WordPerfect records it on the disk as WP{WP}.WPM. Although not really useful, you might note that WordPerfect also creates a temporary macro when you press the [F2], [Shift]-[F2], [F7], [Shift]-[Enter], and several other keys. However, the program uses the same WP{WP}.WPM file, so you still only have one temporary macro to work with.

 

FINDING MACROS ON THE DISK

Macros can be on any disk and any directory. However, if the macro file is not on the current (or "default") drive and directory, WordPerfect will not be able to find it. The easiest to access a macro stored on a disk or directory other than the current one is to explicitly provide the drive and/or the directory.

Examples:

You may omit the drive and directory if you have told WordPerfect where to look for the macro files. The Location of Auxiliary Files option in the Setup menu allows you to identify a regular repository for your macros files. As you become a proficient user of macros, you will want to take advantage of this feature. It will make storing and finding macros much easier if you keep them on a separate disk or in a subdirectory.

You can still keep some macros in the main WordPerfect disk and/or directory (the one that contains the WP.EXE file). If WordPerfect can't find the macro it needs in the spot specified in the Location of Auxiliary Files option, it checks back in the WP.EXE directory.

If you are not sure how to create subdirectories, consult your DOS manual or look it up in any book on MS-DOS. In addition, WordPerfect will create subdirectories for you if you define one after selecting List Files key and pressing the = sign. Enter the name of the new subdirectory, then answer Y to the prompt.

 

ERASING, REDEFINING, AND EDITING MACROS

You can create, editor, or replace macros using the Macro Define ([Ctrl]-[F10]) key. If you choose a name for a macro that already exists, you are given four choices.

If you choose to replace the existing macro, WordPerfect double checks your choice with a Yes/No prompt. Answer carefully. Choosing Yes will forever erase your previous macro. If you don't need an Alt-key or named macro any more, you can erase it from your disks using either DOS or WordPerfect, in the normal manner.

Macro editing is an advanced topic and is discussed in future chapters.

 

HANDS ON: CREATING A MACRO

Let's gain some practical experience creating macros in WordPerfect. Follow the short tutorial that appears below to create two macros for toggling between single and double spacing. Since these macros will be used a lot, we'll save them as Alt-key macros, so that they can be quickly and easily retrieved. Begin by starting WordPerfect in the usual manner.

Let's create the "Switch to Single-Space" macro first:

Key Sequence What it does
1. [Ctrl]-[F10] Starts new macro definition.
2. [Alt]-S Names single-space macro as ALTS.WPM.
3. Single-space [Enter] Describes the macro as Single-space.
4. [Shift]-[F8] Chooses Format command.
5. 1 Selects the Line option.
6. 6 Selects the Spacing option.
7. 1 Sets spacing to 1.
8. 0 0 0 Returns to the document.
9. [Ctrl]-[F10] Completes macro definition.

Here's how this macro works.

The "Switch to Double-Spacing" macro is the same except for the macro name and the number of lines selected:

Key Sequence What it Does
1. [Ctrl]-[F10] Starts new macro definition.
2. [Alt]-D Names double-space macro as ALTD.WPM.
3. Double-space
[Enter]
Describes the macro as Double-space.
4. [Shift]-[F8] Chooses Format command.
5. 1 Selects the Line option.
6. 6 Selects the Spacing option.
7. 2 Sets spacing to 2.
8. 0 0 0 Returns to the document.
9. [Ctrl]-[F10] Completes macro definition.

To recall either macro, press the [Alt] key and either D or S. You can confirm that the macro is working by using the Reveal Codes command, [Alt]-[F3]. Each time you invoke one of the macros, a new line spacing code is inserted at the cursor.

 

CANCELING A MACRO

You may cancel a macro in execution at any time by pressing Cancel. If that doesn't work, try pressing the [Ctrl]-[Break] keys. WordPerfect macros have the ability to "cancel" the Cancel key, rendering it inoperative, but the [Ctrl]-[Cancel] key will normally halt any macro, no matter how it was programmed.

Note that most macros are replayed very fast, and that a series of even 100 keystrokes may take only a moment to replay. You won't have to press the Cancel key before the macro finishes. Rather, canceling a macro is handy when the macro has been slowed down or when you want to exit from a loop in a programmed macro.

You may cancel a macro that you are defining by pressing the Macro Define key. That ends the macro but it also saves what you've done so far on the disk. If you don't want the macro, delete it from the disk or create a new macro using the same name (see the section above on Erasing And Redefining Macros).

 

IMPORTANT TOPICS

This chapter detailed the basics of WordPerfect macros.

Step  	Key Sequence
1.  	[Ctrl]-[F10]
2.  	[Alt]-{key}
3.  	{description}     
	[Enter]
4.     {macro steps}
5.     [Ctrl]-[F10]
Step  	Key Sequence
1.  	[Alt]-{letter}
Step  	Key Sequence
1.  	[Ctrl]-[F10]
2.  	{name}
	[Enter]
3.   	{description}
	[Enter]
4.   	{macro steps}
5.   	[Ctrl]-[F10]
Step  	Key Sequence
1.  	[Alt]-[F10]
2.  	{name}
3.  	[Enter]
Step  	Key Sequence
1.  	[Ctrl]-[F10]
2.  	[Enter]
3.  	{macro steps}
4.  	[Ctrl]-[F10]
Step  	Key Sequence
1.  	[Alt]-[F10]
2.  	[Enter]

---

 Top Contents

WordPerfect 5.1 Macros and Templates
Electronic Edition
Copyright 1990, 1997, Gordon McComb.  All Rights Reserved.
First published by Bantam Electronic Publishing, 1990.
http://www.gmccomb.com/