System Variables |
9.1
System variables are special variables that are maintained by the
WordPerfect program itself. These variables contain information
about current conditions in the program or in the computer system
at any given time. System variables contain information about
the current cursor position, the particular character or code at
the cursor, the states of various settings in the program; in
fact, there is a system variable containing information about
nearly every aspect of the program.
System variables are important because when a macro is played
without user intervention (the usual case), the macro must be
able to obtain necessary information by itself. The macro does
so by accessing the information that WordPerfect maintains in the
system variables.
|
||||||||||||||||||||||||||||||||||
|
?LeftChar |
Contains the character immediately to the left of the cursor |
|
| ?LeftCode | Contains the numerical equivalent of the code immediately to the left of the cursor | |
| ?Line | Contains the position of the cursor from the top of the page (in WordPerfect units | |
| ?Name | Contains the name of the document (if it has been saved) | |
| ?Path | Contains the path of the document (if it has been saved) | |
| ?Page | Contains the number of the page where the cursor is located | |
| ?Position | Contains the position of the cursor from the left edge of the page (in WordPerfect units) | |
| ?RevealCodesActive | Contains the current setting for reveal codes, on or off ("True" or "False") | |
| ?RightChar | Contains the character at the cursor | |
| ?RightCode | Contains the numerical equivalent of the code at the cursor | |
| ?SelectedText | Contains the contents of the current selection ("block") | |
Translating the contents of system variables But other system variables contain information in a form that is not as easy to understand. For example, ?Line and ?Position contain information expressed in WordPerfect units (there are 1200 WordPerfect units to the inch). You will probably want to have that information expressed in inches (or centimeters). You can do that by performing the appropriate arithmetic operation(s) on the system variable (e.g., dividing the value of the system variable by 1200 to obtain the value in inches). Arithmetic operations are discussed later in the tutorial.
Unfortunately, there is no easy way to translate the contents of ?LeftCode and ?RightCode, which contain the numerical equivalents of codes. These system variables are used mainly to determine if the code being "inspected" is a particular code, so you just need to know if its numerical equivalent matches the numerical equivalent of that code.
The simplest way to find out the numerical equivalent of a code is to position your cursor on that code in a document, and run a macro consisting of the the line Type(?RightCode). This will insert the numerical equivalent of that code into the document.
© 1999 Seth H. Katz
All rights reserved
E-MAIL TO AUTHOR
![]() |
![]() |
![]() |