Using parameters in macros
Commands often require parameters, which are constant values (data). Parameters are passed to the compiler (which translates the macro so that it can be played in the application) or passed between subroutines. In this WordPerfect command,
Advance
is the command name, Where
and Amount
are parameters, and AdvanceDown!
and 1.0”
are parameter data. This command advances the cursor down one inch. Parameter names, such as Where
and Amount
, are optional.
Data types
A data type represents information that is needed by a parameter or returned by a command (return value).
In the command syntax, data types are displayed in italics. For example, the enumerations for the Rotation parameter of BoxCaption Rotation
are Degrees90!
, Degrees180!
, Degrees270!
, and None!
. Only these enumerations can replace the data type in the command syntax. Enumerations are identified by a trailing exclamation point. The most common data types in product commands are string, enumeration, and numeric. Programming commands frequently use variables.
Parameter names
Using parameter names is optional. For example, InhibitInput (State: Off!)
works just like InhibitInput (Off!)
. Some product commands have no parameters. Their syntax is usually written with empty parameters, such as PosScreenUp ()
. Some programming commands and all system variables have no parameters. Their syntax is the command name alone, such as Pause
and ?FeatureBar
.
Italics
Italics in macros syntax indicate parameter names or types to be replaced with data. For example, the syntax of GraphicsLineLength
is:
After you replace measurement with a number, the command might be:
or
GraphicsLineLength (21)
Punctuation
You must enclose parameters in parentheses. A missing parenthesis is a common error that prevents macros from compiling. Parentheses are optional for commands without parameters, but must be used with user-defined functions and procedures.
Spaces between command names and the opening parenthesis of the parameter section, and after semicolons in parameters, are optional.
You must separate multiple parameters with semicolons (;). If you omit an optional parameter, include the semicolon in the syntax to keep following parameters in their correct positions. For example,
or
Repeating parameters are enclosed in braces and are separated by semicolons. For example,
When data is supplied, the command could be
Product commands perform product tasks in a specific application. For example,
displays the fourth slide in the current slide show in Presentations.
Product commands are specific for each application. They perform various functions in that application, such as
•
|
|
displaying a dialog box,
InitialCodesStyleDlg |
•
|
|
specifying settings, such as styles,
BorderBottomLine ; user settings, PrefZoom ; or attributes, Font |
•
|
|
enabling and disabling features,
InhibitInput or TableCellIgnoreCalculation |
•
|
|
performing actions, such as inserting a file,
FileInsert or code, PrinterCommand ; renaming a bookmark BookmarkRename ; converting comments to text CommentConvert ; or moving the cursor PosColBottom |
•
|
|
playing macros that are included with the application
AddressMergeShippingMacro |
Product commands that report information (return value) about the state of an application or feature are sometimes called system variables. In WordPerfect, system variables begin with a leading question mark, ?ColumnWidth
. In Presentations, they begin with a leading Env (EnvPaths)
. Some system variables in Presentations have parameters as well as return values.
Product commands and programming commands are not case sensitive.