Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate

Barry MacDonnell's
Toolbox for WordPerfect

Macros, tips, and templates for Corel® WordPerfect® for Windows®
© Copyright 1996-2010 by Barry MacDonnell. All Rights Reserved.

Page updated Jun 17, 2010
WordPerfect Tips
Main tips page | Browse tips

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

Notes

1) 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. That kind of macro code is simply a series of macro commands that were typed or copied into the web site or newsgroup post as ordinary text characters. These 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. Basically, the plain-text macro code must be copied and then saved in WordPerfect in a certain way before it becomes a macro that can be played.

2) 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.

Once you have done this once or twice, you will find it a simple and easy way of using macros that others have written.

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.")

Select all text from beginning to end, and copy the selection to the Windows clipboard with Ctrl+C (or Edit, Copy).

Step 2

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 3

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 "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 double quote marks) 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, 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 4

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 5

Play the macro with Tools, Macro, Play (or Alt+F10).


Tips