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® |
Page updated Sep 10, 2023 |
|
WordPerfect
Tips 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.
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 if you want 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
copy-and-paste-without-any-fancy-formatting
procedure from the source material into WordPerfect, which should help
ensure accuracy.
Note
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. * * *
IMPORTANT UPDATE (March 2022) relating to plain-text code copied from WordPerfect Universe WordPerfect Universe's hosting site had to move to new servers in February 2022, which required updating the software that makes the WordPerfect Universe site work. Unfortunately, the updated software can now affect certain material inside any post that uses the aforementioned Code: window — including any special formatting the writer might have added to some material such as bold, italics, underlining, color, or font changes. The software now renders these format options as "text tags" — such as [B]..[/B] or [COLOR]..[/COLOR] — rather than simply displaying the format effects (e.g., as bold or colored text) as was done in previous years. Moreover, these changes affected hundreds of older, but still useful, posts if they contain such specially formatted macro snippets! (However, not all posts containing macro code have this issue, which adds complexity to finding a workable solution. So far there doesn't appear to be a method that can globally locate the problematic posts to easily remove just the new "text tags".) How might this affect you? If you copy any such macro code with these text tags from WordPerfect Universe into your WordPerfect to create a functioning macro (Steps 2-5 below) you might not be successful, depending on where the changes are located in the raw code. The only solution as of this date is to delete those text tags before you Save & Compile the macro code in Step 5 below. Otherwise, the WordPerfect program will pop an error message and will not compile the macro. A better solution on the WordPerfect Universe site might be found to reverse these changes, and if that happens this Note will be updated.
Note
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], [B] and [/B], etc.) 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
solution (below).
• SOLUTION:
(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). Step 7 (optional if you plan on using the macro often) For quick and easy access to the new macro you can assign it
to a -
[1] keystroke combination ("keyboard shortcut"),
[2] toolbar button, or [3] custom menu. See Customizing WordPerfect here. Tips ☼ 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 (ie.g., 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? |
||
Footnote 1 [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.] |
|||