PLEASE NOTE:
The macros here on the Toolbox for WordPerfect
site that can be downloaded (in .ZIP files)
to your system are already compiled and functioning (see Downloading
and Installing Macros and Templates).
The downloadable macros on the
Toolbox site are not the "raw" or "plain text"
macro code such as you might see posted on a web
page (even on some Toolbox pages) or a newsgroup.
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 web site or newsgroup post 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.
If you use the first release of WordPerfect 11 (i.e., 11.0.0.233, 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 are shipped as part of the program. |
|
How to copy plain-text macro code from
the Internet (i.e., web page, newsgroup post, or e-mail) into
WordPerfect to create a functioning macro. Once you have done this once or twice,
you will find it a simple and easy way of using macros that others
have written. To begin, note the frequent use of the word "copy" on this page. You
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. Hence, the process below is basically a simple
copy-and-paste-without-any-fancy-formatting procedure from the source material into WordPerfect, which should help ensure accuracy.
Step 1
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, 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 needed.
Also, you can ignore any lines at
the beginning and end that contain only horizontal lines,
spaces, hyphens, or similar "separators.")
Note: On WordPerfect
Universe, the posted code is usually (but not always) inserted inside a scrollable Code:
window, located inside the post. The code in that window can be
selected (next step) and copied the same as code in any other part of
the post.
Step 2
Select all
text from beginning to end, and copy the selection to the Windows
clipboard with Ctrl+C (or Edit, Copy).
Note: 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.] Tip: 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
Windows clipboard.
Step 3
Open a new, blank document in WordPerfect and click on Tools, Macro, Macro Toolbar
to display the Macro Toolbar.
Open Reveal Codes
if it is not already open (View, Reveal Codes). This helps with
the next step.
Step 4
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 cursor is located,
and use the arrow keys to reposition it if necessary.
Then click on Edit, Paste Special, Unformatted
Text to paste the macro code into the WP document without
any extraneous formatting or other unwanted codes.
|
Important
Some macros are designed by their authors
to use Search and (sometimes) Replace commands to find various WordPerfect format [codes]
in the document and process them in some way.
Unfortunately,
searching through a document for WordPerfect formatting codes
with a macro requires using the actual binary code in the SearchString/ReplaceString
command's parameter (the part of the command enclosed
in parentheses) -- and this binary code, unlike the rest of the
macro commands (which are ordinary text characters), cannot be
copied into a web page, newsgroup post, or email. It gets stripped
out in the web page, post, or email because other web sites or
Windows programs do not recognize WordPerfect format codes.
Most authors typically work around this limitation
by using plain text characters as a "text placeholder" to
represent the binary code when it is posted on a web page
or newsgroup.
So, after you paste the macro code
into WordPerfect, be sure to replace any indicated text
placeholders in the SearchString() and ReplaceString() commands
(or where otherwise indicated by the author) with the actual
WordPerfect binary codes from the Codes button on the Macro Toolbar.
For example, if you see a command like this
-- SearchString("[HRt]") -- just delete the text string,
[HRt], inside the parentheses (but keep the two ordinary double
quote marks, if any) and, in its place, insert the actual
binary code with the Codes button on the Macro Toolbar.
Note that the Codes button brings up a long
list of codes. In our example, 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., [HRt]). |
Step 5
Save the pasted material with the Save & Compile button on the Macro Toolbar.
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 path to that folder.)
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.
Step 6
Play the macro
with Tools, Macro, Play (or Alt+F10).
Tips
|