| Barry MacDonnell's
Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
| Page updated Feb 26, 2021
Main tips page | Browse more tips
How to copy plain-text macro code from the Internet
(i.e., a web page, newsgroup post, or email) into
WordPerfect to create a functioning macro.
TL;DR? This page is very detailed because I cannot know how much you know about this method. But it is not a very complicated process. Once you have used the following steps once or twice you will find them to be a quick, simple, and easy way to use macros that others have written and publicly posted in "raw" (plain text, uncompiled) form.
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.
[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
On WordPerfect Universe, the posted plain-text 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 (following the instructions in Step 2 below) and copied the same as code in any other part of a post.
If you are copying the macro code from WordPerfect Universe, be sure to select the code directly from the main WordPerfect Universe (thread) screen's "Code:" window and not from inside a "Reply With Quote" window.
Here are some screen shots from WordPerfect Universe showing the scrollable "Code:" window in a post containing some "plain text" macro commands:
Example of Code window showing a small macro
Example of Code window with code selected
Example of Code window with code copied (via right-click on selection)
Doing this will eliminate any WordPerfect Universe formatting "tags" (such as [CODE] and [/CODE]) that might have been added to the posted macro code. These tags are not macro commands.
[You can, of course, use the WordPerfect Universe Forum's Reply screen — but you should copy only the comments and commands between any beginning [code] tag and ending [/code] tag, since those bracketing tags are not part of the macro's code.]
For long macros posted on WordPerfect Universe inside the scrollable Code: window (image), the macro code can extend below the bottom of the visible portion of that window.
Hence it is better to simply click directly on the left side of the first line of code in the Code: window (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 from beginning to end.
(Don't just hold down an arrow key or you might overshoot the end of the code and paint other things on the Forum's screen outside the Code: window.)
Then right-click on the selection (or use Ctrl+C) to copy the selection to the Windows clipboard.
A 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.
This bar has some useful buttons such as "Save & Compile" and "Codes" — both of which you will use later.
This helps with the next step.
The second code is automatically added by the macro toolbar: It displays consecutive line numbers along the left page margin.
Look in Reveal Codes to see where the red block insertion cursor is located, and use the arrow keys to reposition that cursor if necessary, like this:
• PROBLEM: 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
(a) If the macro is designed to be played in an existing document, open that document if it is not already open.
Many macros are designed to be played without having to open any existing document, in which case you can just play them in any new, blank document such as Document1, Document2, etc.
(b) Play the macro with Tools, Macro, Play (or Alt+F10).
For quick and easy access to the new macro you can assign it to a -
 keystroke combination ("keyboard shortcut"),
 toolbar button, or
 custom menu.
See Customizing WordPerfect here.
☼ Note that the macro can be opened for editing at a later time with Tools, Macro, Edit (or Ctrl+F10). It is just another WordPerfect document — but with the special filename extension .wcm. When you edit it, the Macro Toolbar will reappear to let you use the Save & Compile button to save any changes.
☼ You may need to edit the Application() command at the top of the code (if one exists) to change the language code from "EN" (or "US" or other language) to the language version you are using.
Or, if you are using just one language version of WP, just delete the last semicolon along with the "EN," to get something like this:
Application (WordPerfect; "WordPerfect"; Default)
Note that this type of Application() command is the best way to post your own macro code on WordPerfect Universe (or elsewhere) so that those who copy it (and use some other language edition) won't get an error message when they try to compile your macro code.
☼ You can delete any instructions, annotations, or comments in the copied material (i.e., all text following "//" marks up to the end of the line), though usually there is no need to do so (and you may want to keep them for future reference, anyway). Related tip: How to put instructions or comments inside a macro.
☼ For easy access, you can assign the macro to a keystroke combination, a toolbar button, or a menu. See Customizing WordPerfect - Three easy ways to play macros, load programs, type (insert) keystrokes, and use special features by creating your own toolbar buttons, shortcut keys ("hot keys"), and menu selections.
☼ For more information on creating and editing macros, see Need help creating macros and templates?
[Continued from above...]
Rarely, if a macro author forgot to include a text representation for the command's parameter — or did not include an adjacent programmer comment (//...) to tell you what to do — the parameter's item might be changed to something else, such as a simple "?" or some other "odd" text character.
Worse, the macro might not work as intended or even work at all.
Mistakes happen. In this case, you should contact the author. [Remember: Always play new macros on a copy of your document until you are confident they suit your needs.]