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-2017 by Barry MacDonnell. All Rights Reserved.

Page updated Nov 1, 2015
[Original date: Aug 13, 2008]
WordPerfect Tips
Main tips page | Browse tips

How to put instructions or comments inside a macro to annotate the macro code

Related tip:

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

There are several ways a macro writer can put programmer comments or other, non-command information into a macro. Examples of these are shown in dark red below.

Open the macro for editing with Tools, Macro, Edit.

Then use any one (or more) of the following methods.

1. Precede the comment with at least 2 slash (//) marks:

// This is a comment.

These comments can be on a separate line or on the same line as a macro command, following that command.

Two (or more) slash marks are often used to temporarily disable -- "toggle off" -- a macro command.

Note that each paragraph -- text or commands that end with a hard return -- cannot exceed 510 characters including the slash marks. PerfectScript will pop up an error message if you exceed this limit.

2. Bracket the comment -- or even macro commands you want to temporarily disable -- like this:

/* This is a comment. */

-- or like this:

/*
This is a comment.
And this is a comment.
*/

[This method is not available in some earlier versions of WordPerfect.]

Note that each paragraph -- text or commands that end with a hard return -- cannot exceed 510 characters including the bracket characters. PerfectScript will pop up an error message if you exceed this limit.

3. For longer comments, such as those that introduce the macro, you can put the comment inside a "dummy" IfPlatform macro command. The command's (parameter) can be anything that is not recognized by WP as legitimate. For example:

IfPlatform ("My comments begin here.")

This is a comment.

EndIfPlatform

Here, WordPerfect will simply ignore the IfPlatform command and everything inside it.

Note that each paragraph inside the IfPlatform commands -- text that ends with a hard return -- cannot exceed 510 characters. PerfectScript will pop up an error message if you exceed this limit.

4. Put the comment inside a footnote. You can even put macros commands in the footnote: they will not execute when the macro plays.

5. Put comments inside a header and/or footer.

6. Since a macro being edited always displays -- initially, at least -- in Draft mode, you can use regular WordPerfect Comments (Insert, Comment).

7. Put the comment inside a text box, which can be anchored to the page or to a paragraph. Note that text boxes are prone to shift and/or not display all material, so it is better to avoid this method.

This is a comment.