macros you may find here on the Toolbox for WordPerfect site are already compiled and functioning (see Downloading and
Installing Macros and Templates).
Theae downloadable macros (found mostly in the Library inside ZIP files) are not
the "raw" or "plain text" macro code such as you might see
posted on another web site (and even on some other Toolbox pages).
On the other hand, plain-text macro
code -- the subject of the next column -- is simply a series of
macro commands that were typed or copied into that site as ordinary text characters. Those commands
are not yet macros!
The simple, step-by-step procedure in the next column
turns such plain-text macro code into a functioning macro.
* * *
you use the first release of WordPerfect 11 (i.e., 220.127.116.11, as shown in your WordPerfect's Help >
About WordPerfect menu), then you should read this page (in the
WordPerfect 11 section) about a bug in that release that can
impact macros from any source, even those from Corel that were
shipped as part of the program.
How to copy plain-text macro code from the
Internet (i.e., web page, newsgroup post, or email) into WordPerfect
to create a functioning macro.
Once you have done
the following steps once or twice you will find it a quick, simple and easy way of using
macros that others have written.
To begin, note the frequent use of the word "copy" on this
should not have to manually type any text to create the functioning
macro. You can do so
later to edit it, but for now you can simply use standard Windows copy
and paste methods, as explained below.
As we all know,
typing can be prone to error, and macro commands are very
exact. A macro follows a set of instructions (the "macro code"),
but since it is a dumb robot even a single misplaced
character or punctuation mark can prevent it from working properly.
[Always play new macros on a copy of your document until you are
confident they suit your needs.]
Hence, the process
below is basically a simple
procedure from the source material into WordPerfect, which should help
Briefly examine the plain-text macro code
to determine where it begins and ends.
Often, macro writers will use programmer's
comments (in WordPerfect, they typically begin with two slash
marks, "//" [see here for other types])
to tell you where the macro begins and ends.
If not, very often the first command is an Application() command. As often,
the last command is usually Return or Quit.
Don't worry if you don't
see an Application, Return, or Quit command. They are not always
Also, you can ignore any lines at the beginning and end that contain only
horizontal lines, spaces, hyphens, or similar "separators."
[On WordPerfect Universe, the posted
code is usually (but not always) inserted inside a scrollable Code:
window, located inside the body of the post. The code in that window can be
selected (next step) and copied the same as code in any other part of a post.]
text from beginning to end, and copy the selection to the Windows
clipboard with Ctrl+C (or Edit, Copy).
On WordPerfect Universe,
select the macro code directly from the WordPerfect
Universe Forum screen, not from inside a "Reply" screen. This
will eliminate any WordPerfect Universe formatting "tags" that might
have been added by the
original poster. [You can, of course, use the Reply screen -- but
you should copy only the
comments and commands between
any beginning ([code]) and ending ([/code]) tags, since those
bracketing tags are not part of the macro's code.]
For long macros posted on WordPerfect
Universe inside the scrollable Code:
window, the code can extend below the bottom of the window. Simply
click directly on the top left of the code (even though you won't see
any cursor appear there), then hold down the Shift key while you tap
the arrow keys to "paint" the macro's code. (Don't just hold down an
arrow key or you might overshoot the end of the code and paint other
things on the screen.) Then use Ctrl+c to copy the selection to the
WordPerfect macro is really just another form of WordPerfect document
(with the special filename extension .WCM), so you will want to start a
new one to contain the macro commands:
(a) Open a new, blank document.
(b) Click on Tools, Macro, Macro Toolbar to
display the Macro Toolbar [screen shot]. This bar has some useful buttons such as "Save & Compile" and "Codes" -- both of which you will use later.
(c) Open the Reveal Codes window if it is not already open (View, Reveal Codes). This helps
with the next step.
Position your cursor immediately after any codes in the new document --
typically, this is immediately after the
[Open Style][Ln Num: On] codes. Look in Reveal Codes to
see where the red insertion cursor is located, and use the arrow keys to reposition the cursor if necessary.
Then click on Edit, Paste Special,
Unformatted Text to paste the macro code from Step 2 into the macro document.
Using the Unformatted Text feature will paste
the copied material without any extraneous formatting or other unwanted codes.
☼ Important: Some essential parts
of some commands (e.g., WordPerfect symbols or format codes) might not
be completely copied into the macro document -- but there's an easy
Why does this happen in the first place?
macros contain commands that tell the macro what to do when it looks
for, or encounters, a WordPerfect symbol (see Insert, Symbols) or a
WordPerfect format code.
The most common place you will see these in a working macro is in a SearchString() and/or a ReplaceString() command's parameter -- the part of the
command enclosed in parentheses.
However, format codes are "binary codes" and, unlike the
rest of the macro command (which are ordinary text characters), they cannot
be simply copied and pasted into a web page, newsgroup post, or email. These codes (and some WP symbols) get stripped
out because web sites and email programs -- as well as most other Windows
programs -- do not recognize WordPerfect format codes.
Hence, most authors typically work around
this limitation when they post macro code on a web page or
newsgroup by using plain text characters as a "placeholder"
to represent the binary code.
representation is typically a string of text
characters enclosed in quote marks, such as "[HRt]" to represent a hard
return format code. [If there's nothing between the two quote marks and
you believe there should be something there, see Footnote 1.]
☼ The solution:
After you paste the copied macro
code into WordPerfect, be sure to replace any such WordPerfect placeholders.
For WordPerfect symbols, see Insert, Symbol (or Ctrl+W) for the entire Symbol Set.
Similarly, any WordPerfect format code
placeholders in the SearchString() and ReplaceString() commands (or
where otherwise indicated by the author) should be replaced with the actual WordPerfect
binary codes from the Codes button on the Macro Toolbar (displayed when you performed Step 3 above).
For example, when you paste the code into WordPerfect and you see a command like
this (i.e., plain text characters without any actual format codes when viewed in Reveal Codes) --
-- just delete the text string, [HRt],
inside the parentheses (but keep the two ordinary double quote
marks, if any). Then, in its place, insert the actual binary code
with the Codes button on the Macro Toolbar.
The Codes button brings up a
long list of codes. In the example above, after you delete the text
placeholder you would place your cursor between the two (now adjacent)
double quote marks and click the Codes button on the Toolbar to bring
up the Macro Codes dialog containing a list of codes. Under the Search
tab in that dialog, choose HRt from the list, then click the Insert
button, then click Close. In Reveal Codes you should now see a
code [Macro Func], which is the binary code, between the double
quote marks. In the main document window it will display
itself as the particular type of code required by the macro (e.g.,
Save the pasted material with the Save & Compile button on the Macro Toolbar (the bar below the ruler and above the main text area [screen shot]).
Give the macro a name that will help you remember it.
☼ This step saves the macro to your Default
macros folder as shown in Tools, Settings, Files, Merge/Macro. [Advanced users may wish to save to a different folder, and will
therefore need to include the full path to that folder as part of the macro name. (Exception: The macro can be placed in the Supplemental macro folder and the program will find it just by its name.]
☼ The resulting file will have a .wcm
filename extension, which WordPerfect will recognize as a macro
(assuming it has valid commands inside it), and compile it the first
time you play it after creating it (or after editing it).
☼ Messages: If
you get an error message when you press Save & Compile, open
Reveal Codes and check the pasted text for long lines that may have
wrapped into two or more lines with a hard return [HRt] or line break
[Ln Brk] between them. Remove the hard return(s) or line break(s)
to "glue" the lines back together. [The program will recognize commands
that have up to about 512 characters before a hard return. If it is too
long you'll see and error message when you try to save the macro.]
Play the macro
with Tools, Macro, Play (or Alt+F10).
While the macro plays ("runs") a small
audiocassette icon should appear in your computer's notification area
(a.k.a., the "system tray"):
If it's not visible click the "Show hidden icons" button in the notification area.
This icon is handy in case you ever need to
stop (i.e., abort) the macro manually: Just right click on the audiocasette
icon and choose Stop.
Step 7 (optional but recommended)
For quick and easy access, you can assign the macro
 a keystroke combination ("keyboard shortcut"),
 a toolbar button, or
 a custom menu.
See Customizing WordPerfect here.