PerfectScript Journal

July 1998: The Command Inserter

If you write a lot of macros, you probably use the Command Inserter all the time. You can get lots of information from the WordPerfect 8 Command Inserter.

command type
command names
parameter names
required, optional and repeating parameters
enumerations
equivalent token value

Command Type

At the top in the Command Type dropdown, you'll see the command type. When PerfectScript is selected here, only programming commands appear in the Commands list. Likewise, when WordPerfect is selected, only WordPerfect product commands appear.

Command

In the Command list, you'll see the names of all the available commands for the selected type. These names are sorted in alphabetic order. You can type the first few characters in the name to quickly move to the desired command.

Parameters

In the Parameters list, you will see the parameters for the selected command. Parameters listed in bold are required parameters. Parameters that are not bold are optional. Parameters in italics are repeating parameters, meaning you can have more than one item in that parameter. Usually, repeating parameters are enclosed is curly braces. For example,


Case(vVariable; {"Dog"; dog; "Cat" cat})
         

Below the Parameter list, you will see static text indicating what type of information is expected in the currently highlighted parameter.

Enumerations

When a parameter only accepts certain values, an Enumerator list appears listing the valid values. These values are assigned a value numerically that WordPerfect understands. Generally, enumerators end in an exclamation point to help you differentiate them from other variables you may use, but in WPWin 8, there are also enumerators without the exclamation. I suggest you always use the enumerators with the exclamation point. Below the enumerator list, you can see the value of the current enumerator. You can also specify this actual numeric value, but you can run into trouble later on if you do this.

Additional Available Information

But there is even more information you can get from the Command Inserter. But to get it, you need to edit your PerfectScript Preferences. To start PerfectScript, find the actual program in Windows Explorer and double click to start it. This is probably C:\Corel\Suite8\Programs\PS80.EXE. If you can't locate it, you can always use the Windows Find Files utility to locate it.

Once you've started PerfectScript, press Ctrl+Alt+Shift+Enter to enable the advanced menus. Once enabled, you will notice some items in italics on the dialogs and menus of PerfectScript. All the italicized items are enabled when you enabled the advanced menus.

Click Tools > Settings on the menu. Click the Command Inserter tab to see the options for the Command Inserter. Check the option for Show enumeration values. Check the option for Token ID's, then click OK.

Back in WordPerfect, invoke the Command Inserter.

Dump Buttons

The Dump buttons allow you to quickly generate a list of all the commands.

Return Enums

For applicable commands, you can get a list of the possible return value enumerators for the command.

PIDs

A PID is a product identification. In the Command Inserter, the PIDs appear in the Product Type dropdown. If you check the Show all PIDs option, some additional product ID's will appear in that list. These options will look familiar if you wrote macros in WPWin 6.x or 7.

Token IDs

If you checked the Show token ids option in PerfectScript, each command will have a value next to it. This is the value that WP recognizes the command as.

Enumeration Values

If you checked Show enumeration values, as you scroll through a list of enumerations, their values will appear below the enumeration list.

All Enumerations

If you checked Show all enumerations, the enumerations list will include additional undocumented enumerations. Usually these enumerations will not have the exclamation point. Note: These enumerations are reeserved words and should not be used as variable names.

You can experiment with the settings in PerfectScript to determine just what information is most valuable to you. I personally set the Show all enumerations and Show enumeration values options. If you are writing an external program that must interface with WP, you may want to set the Show token ids option.

If you get yourself into trouble with setting too may options, you can always click the button Reset all to Defaults on the General tab of the PerfectScript Settings dialog.

Next month: How to get Region Names for WP dialogs and their controls.

For more information on this topic, get a copy of my book.

For information on ordering my book see my web page.

 

Copyright Notice: The information included in the PerfectScript Journal is protected by US Copyright. The author grants you the right to use the routines in your own macros as needed. You may not sell, distribute, or publish them in any form.
If you choose to use the information here, you do so entirely at your own risk. No representations are made regarding the fitness of this information for your   particular purpose, or for your ability or inability to use the information. You   are advised to make backups of all relevant files before implementing any suggestion  or technique.
© Copyright 1998 by J. Jeppson.