home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR8
/
WP60DOSM.ZIP
/
PROGRAM.ASC
< prev
next >
Wrap
Text File
|
1993-09-22
|
163KB
|
4,953 lines
Programming Commands Index
───────────────────────────────────────────────────────────────
A-C
───────
// (Comment)
AND
ASSERT
ASSIGN
BEEP
BREAK
CALL
CANCEL
CASEOF
CHAIN
CHAR
CONTINUE
CTON
D-F
───────
DEFAULT
DEFAULTUNITS
DISCARD
DISPLAY
DIV
ELSE
ENDFOR
ENDFUNC
ENDIF
ENDPROC
ENDSWITCH
ENDWHILE
ERROR
EXISTS
FOREACH
FORNEXT
FRACTION
FUNCTION
G-O
───────
GETNUMBER
GETSTRING
GETUNITS
GLOBAL
GO
IF
INDIRECT
INPUT
INTEGER
LABEL
LOCAL
LOOK
MENULIST
NEST
NEXT
NOT
NOTFOUND
NTOC
NUMSTR
ONCANCEL
ONERROR
ONNOTFOUND
OR
P-R
───────
PAUSE
PAUSECOMMAND
PAUSEKEY
PAUSESET
PERSIST
PERSISTALL
PRESSKEY
PROCEDURE
PRODUCT
PROMPT
QUIT
REPEAT
RETURN
RUNUNATTENDED
S
───────
SAVESTATE
SHELLASSIGN
SHELLMACRO
SHELLVARIABLE
SHOWATTROFF
SHOWATTRON
SHOWCODE
SHOWCOLOR
SHOWPOSITION
SHOWTEXT
SPEED
STATUSPROMPT
STEP
STRLEN
STRNUM
STRPOS
STRUNIT
SUBSTR
SWITCH
T-Z
───────
TOLOWER
TOUPPER
UNITSTR
UNTIL
USE
USERFUNCTION
VARERRCHK
WAIT
WHILE
XOR
//
Show Me An Example...
─────────────────────────────────────────────────────────────────
Comment (//) reserves text between the Comment command (//) and
the next hard return (Hrt) as comments. Anything reserved as a
comment will be ignored by the macro. Comments are used to
document a macro without affecting it's execution.
Syntax: // Comments [Hrt]
Parameters: Comments
A character expression or a numeric expression
──── ────For Example...
This macro retrieves and prints all documents in the default
directory.
DISPLAY(On!)
DLGInput(on!) // allows keystrokes to be sent to a dialog box
FileManagerDlg
HardReturn
DownArrow
tot:=?List-2
Cancelkey
cnt:=1
WHILE(tot<>cnt)
FileManagerDlg
FileManagerDlg
DownArrow
type("1") //opens the highlighted document
PrintFullDoc
ExitDlg
Type("nn") //"No" to save and "No" to exit WordPerfect
cnt:=cnt+1
ENDWHILE
AND
Show Me An Example...
─────────────────────────────────────────────────────────────────
AND is an operator that evaluates two expressions, usually in a
conditional statement. Conditional statements can be created
with commands such as IF, REPEAT, and WHILE. This operator
performs a logical AND that evaluates a conditional statement as
true only if both the expressions are true.
Parameters: None
See Also: DIV
IF
NOT
OR
REPEAT
WHILE
XOR
──── ────For Example...
This macro counts keystrokes until the user presses Ctrl-Enter.
STATUSPROMPT("Press Ctrl+Enter to quit")
cnt:=0
REPEAT
LOOK(info)
IF((info<>0) AND (info<>-8097))
cnt:=cnt+1
Type(NTOC(info))
ENDIF
UNTIL(info=-8097)
STATUSPROMPT("")
PAUSESET(EndFieldKey)
PROMPT("You pressed "+cnt+" keystrokes. Press F9 to continue")
PAUSE
ASSERT
Show Me An Example...
─────────────────────────────────────────────────────────────────
ASSERT causes a macro to respond as if one of three conditions
exists. This command can assert (or cause) an Error, a Cancel,
or a Not Found condition. Each of these conditions can be used
to end a macro or redirect macro flow. To redirect the flow of a
macro to a specific LABEL, you can use ONCANCEL, ONERROR, or
ONNOTFOUND. A macro will stop if it has not encountered one of
these commands before the corresponding condition has been
asserted. ASSERT will have no effect if a CANCEL, ERROR, or
NOTFOUND command has been used before the ASSERT command to
disable detection of these conditions.
Syntax: ASSERT(Condition)
Parameters: Condition
Specifies the condition to assert. Select an
enumerated type or its numeric equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
CancelCondition! 0 Asserts a
Cancel
ErrorCondition! 1 Asserts an
Error
NotFoundCondition! 2 Asserts a Not
Found
═════════════════════════════════════════════════
See Also: NotFound
CANCEL
ERROR
LABEL
NOTFOUND
ONCANCEL
ONERROR
ONNOTFOUND
──── ────For Example...
This macro prompts the user to highlight text in a document, and
the macro assigns it to a variable.
Display(On!)
ONERROR(error)
LABEL(Begin)
BlockKey
PROMPT("Highlight the text to assign to a variable and press
Enter")
PAUSE
x:=?BlockedText
IF (x="")
ASSERT(ErrorCondition!)
ENDIF
//the user must place more code here to make
QUIT //this macro more functional
LABEL(Error)
BEEP
DisplayRewrite
PROMPT("You must select text to assign it to a variable")
PAUSE
GO(Begin)
ASSIGN
Show Me An Example...
─────────────────────────────────────────────────────────────────
ASSIGN places a value in a WordPerfect variable. The values can
be a numeric expression, measurement expression, character
expression, or other variables. Consider the following examples:
ASSIGN (PERIOD; "Renaissance")
This ASSIGN statement assigns the word "Renaissance" to variable
PERIOD. Note the quotation marks around the character
expression.
ASSIGN (SUM; NUMBER+19)
This ASSIGN statement assigns 19 plus the value of the variable
NUMBER to the variable SUM. For example, if variable NUMBER is
10, variable SUM will be assigned the value of 29.
Syntax: ASSIGN (Variable; Expression)
or
Variable=Expression
or
Variable:=Expression
Parameters: Variable
Any variable less than 29 characters in length can
be used in this parameter.
Expression
All expressions, including variables, can be used
in this parameter.
See Also: DISCARD
GLOBAL
INDIRECT
LOCAL
PERSIST
PERSISTALL
SHELLASSIGN
SHELLVARIABLE
──── ────For Example...
This macro creates a secondary merge file through a series of
prompts.
ASSIGN(More;"Y")
WHILE(TOUPPER(More)="Y")
FOREACH(field;{"First Name";"Last
Name";"Company";"Address";"City";"State";"Zip"})
GETSTRING(info;"Enter the "+field;"Field "+field;)
TYPE(info)
EndField
info:=""
ENDFOR
MergeCode(EndRecord!)
CHAR(More;"Enter another record? Y/N")
ASSIGN(More;NTOC(More))
ENDWHILE
BEEP
Show Me An Example...
─────────────────────────────────────────────────────────────────
The computer beeps when this command is executed. BEEP is often
used to prompt the user when a macro pauses or displays a
message.
Syntax: BEEP
Parameters: None
See Also: ONCANCEL
ONERROR
ONNOTFOUND
PAUSE
PROMPT
──── ────For Example...
This macro beeps if the current document is blank and displays a
message.
DISPLAY(Off!)
IF(?DocBlank)
BEEP
DISPLAY(On!)
PROMPT("The document is blank. Press Tab to continue")
PAUSEKEY(TabKey)
DISPLAY(Off!)
QUIT
ENDIF
BREAK
Show Me An Example...
─────────────────────────────────────────────────────────────────
BREAK breaks out of loops or statements created with SWITCH,
FORNEXT, REPEAT, or WHILE commands. At the point this command is
encountered, the macro is redirected to the end of the loop or
statement, and resumes execution. For example, if this command
breaks out of a WHILE loop, the macro is redirected to the
command immediately following the ENDWHILE command and continues
from that point.
Syntax: BREAK
Parameters: None
See Also: SWITCH
FORNEXT
FOREACH
NEXT
REPEAT
WHILE
──── ────For Example...
This macro counts from one to ten and breaks out of the loop when
it reaches the number seven.
DISPLAY(Off!)
FORNEXT(x;1;9;1)
Type(x)
IF(x=7)
BREAK
ENDIF
ENDFOR
CALL
Show Me An Example...
─────────────────────────────────────────────────────────────────
The CALL command redirects macro execution to the LABEL command
specified in the Label parameter. The macro executes from that
point until it encounters a RETURN command. Macro execution then
returns to the command immediately following the CALL command and
resumes from that point. This command is useful for repeating a
subroutine from any location in the macro.
Syntax: CALL(Label)
Parameters: Label
Any combination of text can specify the label.
The label name used here must correspond to a
LABEL command in the same macro.
See Also: LABEL
RETURN
──── ────For Example...
This macro searches for a period (.) followed by two spaces and
capitalizes the first letter of the next sentence.
DISPLAY(Off!)
PosDocTop
CALL(Convert)
ONNOTFOUND(NotFnd)
LABEL(Begin)
SearchString(". ")
SearchNext
CALL(Convert)
GO(Begin)
LABEL(Convert)
BlockOn(CharMode!)
PosCharNext
ConvertCaseUppercase
BlockOff
RETURN
LABEL(NotFnd)
DISPLAY(On!)
PROMPT("It's finished. Press ENTER to continue.")
PAUSE
PosDocTop
CANCEL
Show Me An Example...
─────────────────────────────────────────────────────────────────
CANCEL determines whether to ignore a Cancel condition while a
macro is running. A Cancel condition is created by pressing the
Cancel key or by using the ASSERT(CancelCondition!) command. By
default, a Cancel condition is not ignored and will affect macro
execution. A Cancel will generally stop a macro, but it can also
be used to redirect execution using ONCANCEL. If an ONCANCEL
command is encountered in the macro before a Cancel occurs, the
macro is redirected to the LABEL specified in ONCANCEL. Pressing
Ctrl+Break always terminates a macro even if CANCEL(Off!) is
used.
Syntax: CANCEL(State)
Parameters: State
Specifies whether to ignore cancel conditions.
Select an enumerated type or its numeric
equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
Off! 0 Ignore Cancel
conditions
On! 1 Do not ignore
Cancel conditions
═════════════════════════════════════════════════
See Also: ASSERT
LABEL
ONCANCEL
──── ────For Example...
This macro constantly prompts for a name until Cancel is pressed.
ONCANCEL CALL(Cancel)
LABEL(Top)
Name:=""
GETSTRING(Name;"Type in a name, (Cancel or Enter) to
quit";"Name")
IF(Name="")
ASSERT(CancelCondition!)
ENDIF
TYPE(Name)
HRt
GO(Top)
LABEL(Cancel)
CANCEL(Off!)
CHAR(Selection;"Do you really want to Quit? Y/N")
SWITCH(TOLOWER(NTOC(Selection)))
CASEOF "y" : QUIT
CASEOF "n" : CANCEL(On!) RETURN
DEFAULT : GO(Cancel)
ENDSWITCH
CASEOF
Show Me An Example...
─────────────────────────────────────────────────────────────────
CASEOF creates individual cases against which a single SWITCH
expression is compared. Each CASEOF can contain one or more
expressions which, when evaluated individually, may be true, or
in other words, provide a match for the SWITCH expression.
For example,
SWITCH(Year)
CASEOF 1776:
GO(Independence)
CASEOF 1988;1992:
GO(Elections)
ENDSWITCH
The first CASEOF is true, or a match, if the SWITCH expression
(variable Year) contains the number 1776. The second CASEOF is a
match if variable Year contains either 1988 or 1992. In other
words, if a CASEOF contains more than one expression, the semi-
colon acts as an "or" rather than as an "and." Both the SWITCH
and the CASEOF expressions are case sensitive (capitalization)
and must match exactly. If a CASEOF match is found for the
SWITCH expression, the commands immediately following that CASEOF
will be executed and the macro does not evaluate any other CASEOF
expression.
Syntax: CASEOF(Expression;Expression;...:)
Parameters: Expression
Specifies the expression to evaluate. All
expressions are valid for this parameter.
See Also: SWITCH
CONTINUE
DEFAULT
ENDSWITCH
GO
──── ────For Example...
This macro constantly prompts for a name until Cancel is pressed.
ONCANCEL CALL(Cancel)
LABEL(Top)
Name:=""
GETSTRING(Name;"Type in a name, (Cancel or Enter) to
quit";"Name")
IF(Name="")
ASSERT(CancelCondition!)
ENDIF
TYPE(Name)
HRt
GO(Top)
LABEL(Cancel)
CANCEL(Off!)
CHAR(Selection;"Do you really want to Quit? Y/N")
SWITCH(TOLOWER(NTOC(Selection)))
CASEOF "y" : QUIT
CASEOF "n" : CANCEL(On!) RETURN
DEFAULT : GO(Cancel)
ENDSWITCH
CHAIN
Show Me An Example...
─────────────────────────────────────────────────────────────────
CHAIN executes the specified macro when the current macro ends.
Unlike other commands, the CHAIN command does not take effect
when it is encountered. Regardless of where the CHAIN command is
placed in the macro, it does not execute the chained macro until
the current macro has finished.
If a macro contains more than one CHAIN command, only the macro
specified in the last encountered CHAIN command is executed. A
QUIT command at the end of the active macro overrides any pending
CHAIN command and will not allow execution of the chained macro.
CHAIN looks for the specified macro first in the current
directory, then in the macros directories, and finally in the
shared WP directory.
Syntax: CHAIN("Filename")
Parameters: Filename
A character expression specifying the macro to
chain.
See Also: NEST
──── ────For Example...
This macro displays a dialog box on the screen. Pending the
user's response, the macro chains the correct macro.
DISPLAY(Off!)
DLGCREATE(x;"TITLE";DLGNoCancel!;;;30;14)
DLGCONTROL(CtrlRadioButton!;a;"Letter";StyInitial!;4;4;10;2)
DLGCONTROL(CtrlRadioButton!;b;"Itinerary";;4;6;10;2)
DLGCONTROL(CtrlRadioButton!;c;"Memo";;4;8;10;2)
DLGCONTROL(CtrlRadioButton!;d;"Fax";;4;10;10;2)
DLGEND
SWITCH (1)
CASEOF a : CHAIN("letter")
CASEOF b : CHAIN("Itin")
CASEOF c : CHAIN("memo")
CASEOF d : CHAIN("fax")
ENDSWITCH
CHAR
Show Me An Example...
─────────────────────────────────────────────────────────────────
The CHAR, or character, command prompts the user for a keystroke.
The numeric equivalent (ascii value) of the keystroke is then
assigned to the variable specified in the CHAR command. As the
name indicates, only one character is accepted and assigned to
the variable. If the user enters more than one character or
presses more than one keystroke, only the first is accepted. If
more than one keystroke needs to be assigned to a variable, use
GETSTRING, GETNUMBER, OR GETUNITS.
Generally, the keystroke is given in response to a question posed
in the optional prompt parameter of this command. The variable
containing the numeric equivalent of the keystroke can be
evaluated later in the macro using commands such as IF or SWITCH.
The numeric equivalent of the keystroke can also be converted
back to the original keystroke using NTOC. For a list of
keystrokes and their numeric equivalents, see Appendix A in the
Appendices section.
Syntax: CHAR(Variable;"Prompt")
Parameters: Variable
Specifies the variable to which the numeric
equivalent of the keystroke will be assigned. Any
variable is valid for this parameter.
Prompt (optional)
A character expression that will display as a
prompt on the status line.
See Also: SWITCH
GETNUMBER
GETSTRING
IF
NTOC
──── ────For Example...
This macro creates a secondary merge file through a series of
prompts.
ASSIGN(More;"Y")
WHILE(TOUPPER(More)="Y")
FOREACH(field;{"First Name";"Last
Name";"Company";"Address";"City";"State";"Zip"})
GETSTRING(info;"Enter the "+field;"Field "+field;)
TYPE(info)
EndField
info:=""
ENDFOR
MergeCode(EndRecord!)
CHAR(More;"Enter another record? Y/N")
ASSIGN(More;NTOC(More))
ENDWHILE
CONTINUE
Show Me An Example...
─────────────────────────────────────────────────────────────────
CONTINUE is used in a SWITCH statement to instruct a macro, after
executing one CASEOF, to continue to the next CASEOF and execute
it without evaluating its expression. This command is optional
and is not required as part of a SWITCH statement.
Syntax: CONTINUE
Parameters: None
See Also: SWITCH
CASEOF
ENDSWITCH
──── ────For Example...
This macro either types a name, an address, or the entire name
and address.
DLGCREATE(x;"TITLE";DLGNoCancel!;;;30;14)
DLGCONTROL(CtrlRadioButton!;a;"Name";StyInitial!;4;4;10;2)
DLGCONTROL(CtrlRadioButton!;b;"Full Address";;4;6;10;2)
DLGCONTROL(CtrlRadioButton!;c;"Address only";;4;8;10;2)
DLGEND
SWITCH (1)
CASEOF a : Type("John Doe")
CASEOF b : Type("John Doe") Hrt
CONTINUE
CASEOF c : Type("123 Anywhere")
ENDSWITCH
CTON
Show Me An Example...
─────────────────────────────────────────────────────────────────
CTON (character to number) converts a character or keystroke to
its numeric equivalent. For a list of numeric equivalents, see
Appendix A in the Appendices section.
Syntax: CTON("Character")
Parameters: Character
Any ASCII character or a variable containing an
ASCII character.
See Also: NTOC
──── ────For Example...
This macro prompts for a character and returns its ascii
equivalent.
GetString(x;"Enter a character:")
ascii:=CTON(x)
Prompt("The ASCII equivalent of "+x+" is "+ascii+".")
Pause
DEFAULT
Show Me An Example...
─────────────────────────────────────────────────────────────────
DEFAULT is used with the SWITCH command to specify a series of
commands to execute if all CASEOF expressions are false. This
command is an optional part of a SWITCH statement, but is useful
for providing a default action if all other cases are false.
Syntax: DEFAULT:
Parameters: There are no parameters, but DEFAULT is always
followed by macro commands to execute.
See Also: SWITCH
CASEOF
CONTINUE
ENDSWITCH
──── ────For Example...
This macro constantly prompts for a name until Cancel is pressed.
ONCANCEL CALL(Cancel)
LABEL(Top)
Name:=""
GETSTRING(Name;"Type in a name, (Cancel or Enter) to
quit";"Name")
IF(Name="")
ASSERT(CancelCondition!)
ENDIF
TYPE(Name)
HRt
GO(Top)
LABEL(Cancel)
CANCEL(Off!)
CHAR(Selection;"Do you really want to Quit? Y/N")
SWITCH(TOLOWER(NTOC(Selection)))
CASEOF "y" : QUIT
CASEOF "n" : CANCEL(On!) RETURN
DEFAULT : GO(Cancel)
ENDSWITCH
DEFAULTUNITS
Show Me An Example...
─────────────────────────────────────────────────────────────────
DEFAULTUNITS sets the default unit of measurement for any
measurement expression that does not contain a unit of measure
character (", i, u, p).
Syntax: DEFAULTUNITS(Measurement)
Parameters: Measurement
Specifies the default unit of measurement for
measurement expressions. Select an enumerated
type or its numeric equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
Inches! 0 Inches as default (")
InchesI! 1 Inches as default (i)
Centimeters! 2 Centimeters as
default
Millimeters! 3 Millimeters as
default
Points! 4 Points as default
WP1200ths! 5 1200ths of an inch as
default
WP42Units! 6 WP42 units as default
═════════════════════════════════════════════════
──── ────For Example...
This macro advances four centimeters from the top of the page
regardless of the current unit of measure.
DISPLAY(Off!)
DefaultUnits(Centimeters!)
Advance(AdvanceFromTop!;4)
DISCARD
Show Me An Example...
─────────────────────────────────────────────────────────────────
DISCARD removes variable definitions from the current macro as
well as variables set with PERSIST or PERSISTALL. Variables
might reside in one of three variable tables: Local, Global, and
Persistent. Variables are discarded in that order. For example,
to discard local, global, and persistent variables all named
ABBEY, you would need to DISCARD(ABBEY) three times to remove
ABBEY from all tables. This command does not specify the table
from which the variable should be discarded; the command must
simply be repeated enough times to clear the desired tables.
This could be done easily in a WHILE loop, for example:
WHILE(EXISTS(Abbey))
DISCARD(Abbey)
ENDWHILE
Syntax: DISCARD(Var1;Var2;...VarN)
Parameters: Variable
Any variable is valid for this parameter.
See Also: ASSIGN
GLOBAL
LOCAL
PERSIST
PERSISTALL
──── ────For Example...
This macro executes a function from within a TYPE command.
Prmt:="Would you like to continue?"
Type ("You pressed "+YesNo(prmt))
//More code for the macro
Quit
FUNCTION YesNo (message)
LOCAL(ans)
IF (EXISTS(ans))
DISCARD(ans)
ENDIF
LABEL(Begin)
CHAR(ans;message+" Y/N")
SWITCH(TOLOWER(NTOC(ans)))
CASEOF "y" : ans:="Y"
CASEOF "n" : ans:="N"
DEFAULT : GO(Begin)
ENDSWITCH
RETURN(ans)
ENDFUNC
DISPLAY
Show Me An Example...
─────────────────────────────────────────────────────────────────
DISPLAY determines whether to display macro execution.
DISPLAY(Off!) is inserted at the beginning of recorded macros and
will remain in effect until replaced with DISPLAY (On!) or
deleted from the macro.
Syntax: DISPLAY(State)
Parameters: State
Specifies whether macro display is on. Select an
enumerated type or its numeric equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
Off! 0 Display off
On! 1 Display on
═════════════════════════════════════════════════
──── ────For Example...
This macro beeps if the current document is blank and displays a
message.
DISPLAY(Off!)
IF(?DocBlank)
BEEP
DISPLAY(On!)
PROMPT("The document is blank. Press Tab to continue")
PAUSEKEY(TabKey)
DISPLAY(Off!)
QUIT
ENDIF
DIV
Show Me An Example...
─────────────────────────────────────────────────────────────────
DIV is an operator that performs a division and returns the
integer portion of the quotient. For example, if the quotient is
2.5, DIV returns 2. DIV must be used in an expression that can
be evaluated by commands such as IF and ASSIGN. DIV is preceded
and followed by expressions to divide, for example, 10 DIV 2.
Parameters: None
See Also: AND
ASSIGN
IF
NOT
OR
REPEAT
WHILE
XOR
──── ────For Example...
This macro averages a series of numbers and returns the quotient
value of the average.
ASSIGN(Last;0)
GETNUMBER(HowMany;"How many numbers do you have to average")
ASSIGN(Y;0)
FORNEXT(Count;1;HowMany)
GETNUMBER(INDIRECT("Number"+Count);"Enter in a number ")
ASSIGN(last;last+Indirect("Number"+Count))
ENDFOR
Type("The quotient of the average of ")
FORNEXT(X;1;HowMany)
TYPE(Indirect("Number"+x)+"+")
ENDFOR
DeleteCharPrevious
Type(" is "+last DIV howmany)
DLGCONTROL
Show Me An Example...
─────────────────────────────────────────────────────────────────
DLGCONTROL add controls such as check boxes, push buttons and
radio buttons to a dialog box. This command customizes the
appearance and use of a dialog box and must be used between
DLGCREATE and DLGEND commands.
Syntax: DLGCONTROL(Type;Variable;"Title";Style;Horizontal
Position;Vertical Position;Wide;High)
Parameters: Type
Specifies the control type to add to the dialog
box. Select an enumerated type or its numeric
equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
CtrlLabel! 0 Not numbered and
cannot be
selected. Useful
for adding
descriptive text
to a dialog.
Does not require
the Variable
parameter.
CtrlOption! 1 A numbered menu
item that can be
selected. Forces
an exit from a
dialog box when
selected. Does
not require the
Variable
parameter.
CtrlPushbutton! 2 A push button
that forces an
exit when
selected.
Does not
require the
Variable
parameter.
CtrlCheckbox! 3 A numbered
check box that
can be
selected. If
the variable
parameter is
0, the check
box will not
be checked.
When the
dialog is
dismissed, the
variable will
return the
state of the
control
(0=Checkbox
not marked,
1=Checkbox
marked).
CtrlRadiobutton! 4 A numbered
radio button.
If the
variable
parameter is
0, the radio
button will
not be
selected.
When the
dialog is
dismissed, the
variable will
return the
state of the
control
(0=Radio
button not
selected,
1=Radio button
selected). To
be in the same
group, radio
button
controls must
be
consecutive.
Radio buttons
are mutually
exclusive.
CtrlNumber! 5 A numbered entry
field that
accepts only
positive numbers.
The variable sets
the initial value
and when the
dialog is
dismissed,
returns the value
of the control.
CtrlMeasure! 6 An entry field
that accepts
only
measurements.
The
measurement is
displayed in
the current
unit of
measurement.
The variable
sets the
initial value
and when the
dialog is
dismissed,
returns the
value of the
control.
CtrlText! 7 An entry field
that accepts a
single line of
text. The
line length
allowed is
determined by
the width
parameter.
CtrlFilename! 8 An entry field
that accepts
only ASCII
characters and
no spaces.
The variable
set the
initial value
and when the
dialog is
dismissed,
returns the
value of the
control.
CtrlList! 9 A list box.
The variable
must be the
name of an
array that
defines each
item in the
list. The
array
requirements
are:
Var[0]=number
of items in
list box.
Var[1] -
Var[x]=each
list box item.
CtrlDropList! 10 A drop list.
Same
requirements
for CtrlList!
above.
═════════════════════════════════════════════════
Variable (optional)
Sets values to and returns values from the
controls. See control type descriptions for
information on how the variable works with
specific controls.
Title (optional)
A character expression specifying the control
title. To create a mnemonic letter in the title,
precede the letter with a tilde (~).
Style (optional)
Specifies a control style. The styles can be
concatenated with a plus sign (+), for example,
(StyNoSpaces!+StyNoNumber!). Select an enumerated
type or its numeric equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
StyOK! 1 Makes a
CtrlPushButton!
function as the
OK button. The
variable will be
0 if the
pushbutton
dismissed the
dialog.
StyCancel! 2 Makes a
CtrlPushButton!
function as the
Cancel button. The
variable will be -1
if the pushbutton
dismissed the
dialog.
StySigned! 4 Allows CtrlNumber!
control to accept
negative numbers.
StyCounter! 8 Adds counter
controls (up/down
arrows) to the
CtrlNumber! control.
StyNoSpaces! 16 Prohibits spaces
from being
entered in the
CtrlText!
control. With
this style, the
space bar will
terminate input.
StyNoBox! 32 Removes the box
surrounding list
or entry controls
in Text Mode.
StyNoSort! 64 Prevents items in a
list control from
being sorted.
StyChild! 128 Makes the control
a child or sub-
control of the
previous non-
child control.
StyNoScroll! 256 Turns off the
scroll bar on a
CtrlList!
control.
StyNoNumber! 512 Removes the
number on a
numbered control.
A control with
this style cannot
be selected with
a number, however
mnemonics can
still be used.
StyDancing! 1024 Allows a control to
display only when it
can be selected.
StyNoPeriod! 2048 Removes the
period after a
control number.
StyGray! 4096 Prevents a control
from being selected.
StyMnemonic! 8192 Replaces the
control number
with the mnemonic
character
specified in the
title parameter.
StyInitial! 16384 Specifies the
control as the
active control when
a dialog is
initially displayed.
StyDefault! 32768 Specifies the
control as the
default control.
Any time the cursor
would normally
return to the OK
button, it will move
to this control
instead.
═════════════════════════════════════════════════
Horizontal Position (optional)
A numeric expression specifying the horizontal
position of the control within the dialog. The
position is determined in character spaces by rows
and columns with 0 being the first column, first
row (upper left position).
Vertical Position (optional)
See Horizontal Position parameter above.
Width (optional)
A numeric expression specifying the width of the
control in character spaces. If this parameter is
not specified, the control conforms to the size of
the control title.
Height (optional)
See Width parameter description above. If this
parameter is not specified, the height is set to
2.
See Also: DLGCREATE
DLGEND
──── ────For Example...
This macro displays a dialog box with all the control options.
chkbox:=1
num:=31
LstAry:={"One";"Uno";"Ein"}
DLGCREATE(x;"TITLE";DLGNoCancel!;;;50;20)
DLGCONTROL(CtrlLabel!;;"Descriptive Label";StyGray!;1;1;5;1)
DLGCONTROL(CtrlOption!;;"Option";StyNoNumber!;30;3;10;2)
DLGCONTROL(CtrlPushButton!;;"Push
Button";StyNoNumber!;4;5;11;2)
DLGCONTROL(CtrlCheckBox!;chkbox;"Check
Box";StyNoNumber!;30;5;9;2)
DLGCONTROL(CtrlRadioButton!;VarRB;"Radio
Button";StyInitial!;4;3;10;2)
DLGCONTROL(CtrlNumber!;num;"Number";StySigned!+StyCounter!;
4;7;3;2)
DLGCONTROL(CtrlMeasure!;meas;"Measurement";StyNoNumber!+
StyNoBox!;30;7;3;2)
DLGCONTROL(CtrlText!;txt;"Text";StyNoNumber!;4;9;35;2)
DLGCONTROL(CtrlFilename!;flname;"~Filename";StyMnemonic!;
4;11;12;2)
DLGCONTROL(CtrlList!;LstAry;"List";StyNoSort!;4;13;12;3)
DLGCONTROL(CtrlDropList!;LstAry;"Drop List";StyNoSort!+
StyNoNumber!;25;13;12;3)
DLGEND
DLGCREATE
Show Me An Example...
─────────────────────────────────────────────────────────────────
DLGCREATE is the opening command for creating and displaying a
dialog box. The dialog box is displayed when this command is
encountered. This command must be followed by at least one
control defined by DLGCONTROL.
Syntax: DLGCREATE(Variable;"Title";Style;Horizontal
Position;Vertical Position;Width;Height)
Parameters: Variable
Specifies the variable containing the number of
the Control used to dismiss the dialog.
Control Numeric Description
Equivalent
═════════════════════════════════════════════════
OK 0 Dialog
dismissed with
OK
Cancel -1 Dialog
dismissed
with Cancel
User-defined control X Where "X"
is the
number of
the
control.
Control
numbers are
determined
by the
order in
which they
are created
by a
DLGCONTROL
command.
For
example,
the first
control
defined is
1, the
second
defined is
2, and so
forth.
═════════════════════════════════════════════════
Title
A character expression specifying the dialog
title.
Style
Specifies the dialog style. Select an enumerated
type or its numeric equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
DlgNoOK! 1 Removes OK button
DlgNoCancel! 2 Removes Cancel
button
DlgNoBorder! 4 Removes border
DlgNoShadow! 8 Removes shadow
DlgExit! 16 Dismisses the dialog
immediately after the
first key or control is
pressed
DlgNoClear! 32 Does not save or
restore the screen
DlgInactive! 64 Dialog displays
while macro
execution continues.
═════════════════════════════════════════════════
Horizontal Position (optional)
A numeric expression specifying the horizontal
position of the dialog. The position is
determined in character spaces by rows and columns
with 0 being the first column, first row (upper
left position). If no position is specified, the
dialog is centered.
Vertical Position (optional)
See Horizontal Position parameter above.
Width (optional)
A numeric expression specifying the width of the
dialog in character spaces. If this parameter is
not specified, the control is sized to accommodate
the number of controls.
Height (optional)
See Width parameter above.
See Also: DLGCONTROL
DLGEND
──── ────For Example...
This macro displays a dialog box on the screen. Pending the
user's response, the macro chains the correct macro.
DISPLAY(Off!)
DLGCREATE(x;"TITLE";DLGNoCancel!;;;30;14)
DLGCONTROL(CtrlRadioButton!;a;"Letter";StyInitial!;4;4;10;2)
DLGCONTROL(CtrlRadioButton!;b;"Itinerary";;4;6;10;2)
DLGCONTROL(CtrlRadioButton!;c;"Memo";;4;8;10;2)
DLGCONTROL(CtrlRadioButton!;d;"Fax";;4;10;10;2)
DLGEND
SWITCH (1)
CASEOF a : CHAIN("letter")
CASEOF b : CHAIN("Itin")
CASEOF c : CHAIN("memo")
CASEOF d : CHAIN("fax")
ENDSWITCH
DLGEND
Show Me An Example...
─────────────────────────────────────────────────────────────────
DLGEND is the closing command for creating and displaying dialog
boxes.
Syntax: DLGEND
Parameters: None
See Also: DLGCONTROL
DLGCREATE
──── ────For Example...
This macro displays a dialog box on the screen. Pending the
user's response, the macro chains the correct macro.
DISPLAY(Off!)
DLGCREATE(x;"TITLE";DLGNoCancel!;;;30;14)
DLGCONTROL(CtrlRadioButton!;a;"Letter";StyInitial!;4;4;10;2)
DLGCONTROL(CtrlRadioButton!;b;"Itinerary";;4;6;10;2)
DLGCONTROL(CtrlRadioButton!;c;"Memo";;4;8;10;2)
DLGCONTROL(CtrlRadioButton!;d;"Fax";;4;10;10;2)
DLGEND
SWITCH (1)
CASEOF a : CHAIN("letter")
CASEOF b : CHAIN("Itin")
CASEOF c : CHAIN("memo")
CASEOF d : CHAIN("fax")
ENDSWITCH
DLGINPUT
Show Me An Example...
─────────────────────────────────────────────────────────────────
DLGINPUT determines whether to suspend macro execution while a
dialog box is displayed. If execution is suspended, the user
must close the dialog box before the macro continues. If
execution is not suspended, the macro can be programmed to make
selections in the dialog box as well as close it. The default
macro state is DLGINPUT(Off!).
Syntax: DLGINPUT(State)
Parameters: State
Specified whether macro execution is suspended.
Select an enumerated type or its numeric
equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
Off! 0 Suspend macro execution
On! 1 Do not suspend Macro
execution
═════════════════════════════════════════════════
──── ────For Example...
This macro retrieves and prints all documents in the default
directory.
DISPLAY(On!)
DLGInput(on!) // allows keystrokes to be sent to a dialog box
FileManagerDlg
HardReturn
DownArrow
tot:=?List-2
Cancelkey
cnt:=1
WHILE(tot<>cnt)
FileManagerDlg
FileManagerDlg
DownArrow
type("1") //opens the highlighted document
PrintFullDoc
ExitDlg
Type("nn") //"No" to save and "No" to exit WordPerfect
cnt:=cnt+1
ENDWHILE
ELSE
Show Me An Example
─────────────────────────────────────────────────────────────────
ELSE is used with the IF command to specify macro commands to
execute when the IF statement is false. Commands placed between
the ELSE and the ENDIF commands are executed only if the value of
the relational expression in the IF statement is false. If ELSE
is not used within an IF statement, and if the statement is
false, the macro moves to the command following ENDIF and resumes
execution.
Syntax: ELSE
Parameters: None
See Also: IF
ENDIF
──── ────For Example...
This macro prints the current document path and filename in a
footer.
IF(?Name<>"")
FooterB(Create!)
TYPE(?Path+?Name)
SubstructureExit
ELSE
PROMPT("The file hasn't been saved yet. Please save and re-run
the macro.")
PAUSE
ENDIF
ENDFOR
Show Me An Example...
─────────────────────────────────────────────────────────────────
ENDFOR is the closing command for a FORNEXT-ENDFOR and a FOREACH-
ENDFOR loop.
Syntax: ENDFOR
Parameters: None
See Also: FORNEXT
FOREACH
──── ────For Example...
ASSIGN(More;"Y")
WHILE(TOUPPER(More)="Y")
FOREACH(field;{"First Name";"Last
Name";"Company";"Address";"City";"State";"Zip"})
GETSTRING(info;"Enter the "+field;"Field "+field;)
TYPE(info)
EndField
info:=""
ENDFOR
MergeCode(EndRecord!)
CHAR(More;"Enter another record? Y/N")
ASSIGN(More;NTOC(More))
ENDWHILE
ENDFUNC
Show Me An Example...
─────────────────────────────────────────────────────────────────
ENDFUNC is the closing command for a FUNCTION definition.
Syntax: ENDFUNC
Parameters: None
See Also: FUNCTION
──── ────For Example...
This macro executes a function from within a TYPE command.
Prmt:="Would you like to continue?"
Type ("You pressed "+YesNo(prmt))
//More code for the macro
Quit
FUNCTION YesNo (message)
LOCAL(ans)
IF (EXISTS(ans))
DISCARD(ans)
ENDIF
LABEL(Begin)
CHAR(ans;message+" Y/N")
SWITCH(TOLOWER(NTOC(ans)))
CASEOF "y" : ans:="Y"
CASEOF "n" : ans:="N"
DEFAULT : GO(Begin)
ENDSWITCH
RETURN(ans)
ENDFUNC
ENDIF
Show Me An Example...
─────────────────────────────────────────────────────────────────
ENDIF is the closing command for an IF-ENDIF conditional
statement.
Syntax: ENDIF
Parameters: None
See Also: ELSE
IF
──── ────For Example...
This macro prints the current document path and filename in a
footer.
IF(?Name<>"")
FooterB(Create!)
TYPE(?Path+?Name)
SubstructureExit
ELSE
PROMPT("The file hasn't been saved yet. Please save and re-run
the macro.")
PAUSE
ENDIF
ENDPROC
Show Me An Example...
─────────────────────────────────────────────────────────────────
ENDPROC is the closing command for a PROCEDURE definition.
Syntax: ENDPROC
Parameters: None
See Also: PROCEDURE
──── ────For Example...
This macro prompts for a file to retrieve. It then calls a
Procedure to retrieve the file.
GLOBAL(Path;Filename)
LABEL(Begin)
GetString(Path;"Enter the Path of the file to retrieve.")
GetString(Filename;"Enter the filename to retrieve.")
Retrieve() //calls the procedure Retrieve
Error(Off!)
IF(?Name="")
GO(Begin)
ENDIF
QUIT
PROCEDURE Retrieve()
ONERROR CALL(Error)
FileRetrieve(Path+Filename)
ENDPROC
LABEL(Error)
Input("The File doesn't exist. Press Enter to continue")
RETURN
ENDSWITCH
Show Me An Example...
─────────────────────────────────────────────────────────────────
ENDSWITCH is the closing command for a SWITCH-ENDSWITCH
conditional statement.
Syntax: ENDSWITCH
Parameters: None
See Also: SWITCH
──── ────For Example...
This macro constantly prompts for a name until Cancel is pressed.
ONCANCEL CALL(Cancel)
LABEL(Top)
Name:=""
GETSTRING(Name;"Type in a name, (Cancel or Enter) to
quit";"Name")
IF(Name="")
ASSERT(CancelCondition!)
ENDIF
TYPE(Name)
HRt
GO(Top)
LABEL(Cancel)
CANCEL(Off!)
CHAR(Selection;"Do you really want to Quit? Y/N")
SWITCH(TOLOWER(NTOC(Selection)))
CASEOF "y" : QUIT
CASEOF "n" : CANCEL(On!) RETURN
DEFAULT : GO(Cancel)
ENDSWITCH
ENDWHILE
Show Me An Example...
─────────────────────────────────────────────────────────────────
ENDWHILE is the closing statement for a WHILE-ENDWHILE loop.
Syntax: ENDWHILE
Parameters: None
See Also: WHILE
──── ────For Example...
This macro creates a secondary merge file through a series of
prompts.
ASSIGN(More;"Y")
WHILE(TOUPPER(More)="Y")
FOREACH(field;{"First Name";"Last
Name";"Company";"Address";"City";"State";"Zip"})
GETSTRING(info;"Enter the "+field;"Field "+field;)
TYPE(info)
EndField
info:=""
ENDFOR
MergeCode(EndRecord!)
CHAR(More;"Enter another record? Y/N")
ASSIGN(More;NTOC(More))
ENDWHILE
ERROR
Show Me An Example...
─────────────────────────────────────────────────────────────────
ERROR determines whether an error condition should be ignored
while a macro is running. By default, an error is not ignored
and generally stops macro execution. ERROR can also redirect
execution with ONERROR. If an ONERROR command is encountered in
the macro before an Error occurs, the macro is redirected to the
LABEL specified in ONERROR.
Syntax: Error(State)
Parameters: State
Specifies whether to ignore errors. Select an
enumerated type or its numeric equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
Off! 0 Ignore errors
On! 1 Do not ignore
errors
═════════════════════════════════════════════════
See Also: ASSERT
LABEL
ONERROR
──── ────For Example...
This macro prompts for a file to retrieve. It then calls a
Procedure to retrieve the file.
GLOBAL(Path;Filename)
LABEL(Begin)
GetString(Path;"Enter the Path of the file to retrieve.")
GetString(Filename;"Enter the filename to retrieve.")
Retrieve() //calls the procedure Retrieve
Error(Off!)
IF(?Name="")
GO(Begin)
ENDIF
QUIT
PROCEDURE Retrieve()
ONERROR CALL(Error)
FileRetrieve(Path+Filename)
ENDPROC
LABEL(Error)
Input("The File doesn't exist. Press Enter to continue")
RETURN
EXISTS
Show Me An Example...
─────────────────────────────────────────────────────────────────
EXISTS is used in conjunction with other commands, such as IF, to
determine if the specified variable exists. For a variable to
exist, it must have been assigned a value. The value returned
represents the variable table the variable table in which the
variable exists.
Value Description
═════════════════════════════════════════════════
0 Does not exist
1 Exists in local table
2 Exists in global table
3 Exists in persist table
═════════════════════════════════════════════════
Syntax: EXISTS(Variable)
Parameters: Variable
Specifies the variable to evaluate.
See Also: ENDIF
GLOBAL
IF
LOCAL
PERSIST
──── ────For Example...
This macro executes a function from within a TYPE command.
Prmt:="Would you like to continue?"
Type ("You pressed "+YesNo(prmt))
//More code for the macro
Quit
FUNCTION YesNo (message)
LOCAL(ans)
IF (EXISTS(ans))
DISCARD(ans)
ENDIF
LABEL(Begin)
CHAR(ans;message+" Y/N")
SWITCH(TOLOWER(NTOC(ans)))
CASEOF "y" : ans:="Y"
CASEOF "n" : ans:="N"
DEFAULT : GO(Begin)
ENDSWITCH
RETURN(ans)
ENDFUNC
FOREACH
Show Me An Example...
─────────────────────────────────────────────────────────────────
FOREACH is the opening command of a FOREACH-ENDFOR conditional
loop. A FOREACH loop executes all commands between FOREACH and
ENDFOR. The number of times this loop executes depends on the
number of items specified between the braces ({}). For example,
if the command contains four Item parameters, the loop runs four
times. Each time the loop executes, the next item is assigned to
the variable specified in the Variable parameter. When the
variable contains the value of the last item, the loop executes a
final time. The macro then proceeds to the command immediately
following ENDFOR and resumes.
Syntax: FOREACH(Variable;{Item1;Item2;...ItemN})
Parameters: Variable
Any variable is valid for this parameter. The
variable specified here will contain the first
item, and is replaced by the next item with each
repetition of the loop.
Item
A character expression, numeric expression, or
measurement expression specifying the item to
assign to the variable.
See Also: ENDFOR
FORNEXT
──── ────For Example...
This macro creates a secondary merge file through a series of
prompts.
ASSIGN(More;"Y")
WHILE(TOUPPER(More)="Y")
FOREACH(field;{"First Name";"Last
Name";"Company";"Address";"City";"State";"Zip"})
GETSTRING(info;"Enter the "+field;"Field "+field;)
TYPE(info)
EndField
info:=""
ENDFOR
MergeCode(EndRecord!)
CHAR(More;"Enter another record? Y/N")
ASSIGN(More;NTOC(More))
ENDWHILE
FORNEXT
Show Me An Example...
─────────────────────────────────────────────────────────────────
FORNEXT is the opening command of a FORNEXT-ENDFOR conditional
loop. The FORNEXT command begins a loop which executes all
commands between the FORNEXT and its corresponding ENDFOR a
specific number of times. The commands between FORNEXT and
ENDFOR are executed until the Variable parameter exceeds the Stop
parameter. When the loop has executed the specified number of
times, the macro proceeds to the command immediately following
ENDFOR and resumes.
Syntax: FORNEXT(Variable;Start;Stop;Step)
Parameters: Variable
Any variable is valid for this parameter. The
variable specified here initially contains the
value of the Start parameter, and will be replaced
by an incremented (or decremented) value with each
repetition of the loop.
Start
A numeric expression or a measurement expression
specifying the initial value of the loop.
Stop
A numeric expression or a measurement expression
specifying the value to terminate the loop.
Step (optional)
A numeric expression or a measurement expression
specifying the value with which to increment the
Variable parameter. If this parameter is not
specified, the Variable parameter is incremented
(or decremented) by a value of 1.
See Also: ENDFOR
FOREACH
──── ────For Example...
This macro creates a user specified number of return labels.
Display(Off!)
GetNumber(tot;"How many return address labels would you like?")
FORNEXT(cnt;1;tot;1)
Type("Your name")
Hrt
Type("Your company")
Hrt
Type("Your address")
Hrt
Type("City, State ZIP")
Hpg
ENDFOR
FRACTION
Show Me An Example...
─────────────────────────────────────────────────────────────────
FRACTION returns the fractional portion of a numeric expression.
For example, since the quotient of 3/2 is 1.5, FRACTION(3/2)
returns the value 0.5. This command is generally used in
conjunction with commands such as IF, ASSIGN, or Type.
Syntax: FRACTION(Number)
Parameters: Number
A numeric expression specifying the number to
evaluate. This numeric expression often contains
a mathematical operation such as division.
See Also: ASSIGN
IF
INTEGER
Type
──── ────For Example...
This macro prompts for a numerator followed by a denominator and
performs the division of the two numbers. The macro returns the
integer value of the nearest whole number.
DISPLAY(Off!)
GETNUMBER(num1;"Enter the numerator")
GETNUMBER(num2;"Enter the denominator")
x:=FRACTION(num1/num2)
y:=INTEGER(num1/num2)
IF(x>=0.5)
num:=y+1
ELSE
num:=y
ENDIF
type(num)
FUNCTION
Show Me An Example...
─────────────────────────────────────────────────────────────────
FUNCTION is the opening command for a FUNCTION-ENDFUNC
definition. A FUNCTION is a subroutine to which you can pass
information and from which you can receive information. FUNCTION
defines the function name and the parameter names as well as
includes a series of commands to be executed when the FUNCTION is
called. A RETURN command is used in the FUNCTION to return the
result of the function operation. If RETURN is not used, the
FUNCTION will return a value of 0. Commands after an ENDFUNC are
ignored, so all FUNCTIONs should be placed at the end of a macro.
Also, a FUNCTION cannot be defined within another FUNCTION
definition.
Creating and calling FUNCTIONs is much like creating, filling in,
and executing your own Macro Commands. The function name is
comparable to a command name and the parameter names represent
aspects of the FUNCTION that can be manipulated. For example,
you could create a FUNCTION that returns the average of six
numbers. The sequence of commands would look like this:
FUNCTION Avg(N1;N2;N3;N4;N5;N6)
Sum=N1+N2+N3+N4+N5+N6
Average=Sum/6
RETURN(Average)
ENDFUNC
Notice that the FUNCTION name is Avg and that the parameters do
not contain any information; they are simply "holding places" for
number one, number two, etc.. The actual numbers to fill in the
parameters will be passed when the FUNCTION is called. The
RETURN command returns the contents of variable Average to the
location from which the FUNCTION is called.
To call a FUNCTION, you simply state the function name and fill
in the parameters. You must pass the same number of parameters
as originally defined in the FUNCTION. Since the FUNCTION can
return information, it must be called from within a command or
statement that can evaluate its contents or perform an action
such as IF, ASSIGN, or Type. For example, to call FUNCTION Avg
and type the average of the six numbers passed to it, the command
is:
Type(Avg(4;10;65;9;11;47))
FUNCTIONs can be in the macro from which they are called, in
another macro, or they can be combined into a macro file library.
This library is a macro that doesn't execute, but simply contains
FUNCTIONs that may be useful in many macros. If a FUNCTION isn't
defined in the macro that calls it, the USE command must be
placed in the calling macro to identify which macro contains the
FUNCTION. If you are storing FUNCTIONs in a macro file library,
the file must be compiled before it can be used. To compile,
simply play the macro.
Syntax: FUNCTION Name(Parameter1;Parameter2;...ParN)
Parameters: Function Name
Specifies the FUNCTION name. Although this
parameter is usually text, it is not considered a
character expression and should not be in quotes.
Parameter (optional)
Specifies the parameter names to which information
will be passed when the FUNCTION is called. If no
parameters are specified, The FUNCTION can still
be called, executed, and evaluated.
See Also: ASSIGN
ENDFUNC
GLOBAL
IF
LOCAL
PROCEDURE
Type
USE
──── ────For Example...
This macro executes a function from within a TYPE command.
Prmt:="Would you like to continue?"
Type ("You pressed "+YesNo(prmt))
//More code for the macro
Quit
FUNCTION YesNo (message)
LOCAL(ans)
IF (EXISTS(ans))
DISCARD(ans)
ENDIF
LABEL(Begin)
CHAR(ans;message+" Y/N")
SWITCH(TOLOWER(NTOC(ans)))
CASEOF "y" : ans:="Y"
CASEOF "n" : ans:="N"
DEFAULT : GO(Begin)
ENDSWITCH
RETURN(ans)
ENDFUNC
GETNUMBER
Show Me An Example...
─────────────────────────────────────────────────────────────────
GETNUMBER displays a dialog box in which the user enters a
numeric expression. When the dialog box displays, the macro
pauses and allows the user to enter in a number. The number is
then assigned to the variable specified in the Variable
parameter. If the user enters a keystroke other than a number,
the value of 0 is assigned to the variable.
Syntax: GETNUMBER(Variable;"Prompt";"Title")
Parameters: Variable
Any variable is valid for this parameter. The
variable contains the number entered by the user.
Prompt (optional)
A character expression specifying the prompt in
the dialog box.
Title (optional)
A character expression specifying the title of the
dialog box.
See Also: GETSTRING
GETUNITS
──── ────For Example...
This macro creates a user specified number of return labels.
DISPLAY(Off!)
GETNUMBER(tot;"How many return address labels would you like?")
FORNEXT(cnt;1;tot;1)
Type("Your name")
HRt
Type("Your company")
HRt
Type("Your address")
HRt
Type("City, State ZIP")
HPg
ENDFOR
GETSTRING
Show Me An Example...
─────────────────────────────────────────────────────────────────
GETSTRING displays a dialog box in which the user enters a
character expression. When the dialog box displays, the macro
pauses while the user types in text. If the optional Length
parameter is specified, the dialog box prevents the user from
entering more text than the number of characters specified. The
text is assigned to the variable specified in the Variable
parameter.
Syntax: GETSTRING(Variable;"Prompt";"Title";Length)
Parameters: Variable
Any variable is valid for this parameter. The
variable contains the text typed in by the user.
Prompt (optional)
A character expression specifying the prompt in
the dialog box.
Title (optional)
A character expression specifying the title of the
dialog box.
Length (optional)
A numeric expression specifying, in characters,
the maximum amount of text allowed.
See Also: GETNUMBER
GETUNITS
──── ────For Example...
This macro prompts for a character and returns its ascii
equivalent.
GETSTRING(x;"Enter a character:")
ascii:=CTON(x)
PROMPT("The ASCII equivalent of "+x+" is "+ascii+".")
PAUSE
GETUNITS
Show Me An Example...
─────────────────────────────────────────────────────────────────
GETUNITS displays a dialog box in which the user enters a
measurement expression and, optionally, a unit of measurement
character (",i,u,p). When the dialog box displays, the macro
pauses while the user types in a measurement. If no character is
specified, the macro will use the default unit of measurement.
Syntax: GETUNITS(Variable;"Prompt";"Title")
Parameters: Variable
Any variable is valid for this parameter. The
variable contains the measurement entered by the
user.
Prompt (optional)
A character expression specifying the prompt in
the dialog box.
Title (optional)
A character expression specifying the title of the
dialog box.
See Also: GETNUMBER
GETSTRING
──── ────For Example...
This macro prompts for and sets top and bottom margins.
SAVESTATE
AutoCodePlacement(On!)
SetupSave
GETUNITS(margint;"Enter top margin";"Margin")
GETUNITS(marginb;"Enter bottom margin";"Margin")
MarginTop(margint)
MarginBottom(marginb)
GLOBAL
Show Me An Example...
─────────────────────────────────────────────────────────────────
GLOBAL specifies variables to be used in the current macro, in
FUNCTION's or PROCEDURE's of the current macro, or chained or
nested macros.
Syntax: GLOBAL(Var1;Var2;...VarN)
Parameters: Variable
Any variable is valid for this parameter.
See Also: CHAIN
FUNCTION
LOCAL
NEST
PERSIST
PROCEDURE
──── ────For Example...
This macro prompts for a file to retrieve. It then calls a
Procedure to retrieve the file.
GLOBAL(Path;Filename)
LABEL(Begin)
GETSTRING(Path;"Enter the Path of the file to retrieve.")
GETSTRING(Filename;"Enter the filename to retrieve.")
Retrieve() //calls the procedure Retrieve
ERROR(Off!)
IF(?Name="")
GO(Begin)
ENDIF
QUIT
PROCEDURE Retrieve()
ONERROR CALL(Error)
FileRetrieve(Path+Filename)
ENDPROC
LABEL(Error)
INPUT("The File doesn't exist. Press Enter to continue")
RETURN
GO
Show Me An Example...
─────────────────────────────────────────────────────────────────
GO redirects macro execution to the label specified in the Label
parameter.
Syntax: GO(Label)
Parameters: Label
Specifies the label to which the macro should be
directed. The specified label must match a label
specified by a LABEL command elsewhere in the
macro.
See Also: CALL
LABEL
──── ────For Example...
This macro searches for a period (.) followed by two spaces and
capitalizes the first letter of the next sentence.
DISPLAY(Off!)
PosDocTop
CALL(Convert)
ONNOTFOUND(NotFnd)
LABEL(Begin)
SearchString(". ")
SearchNext
CALL(Convert)
GO(Begin)
LABEL(Convert)
BlockOn(CharMode!)
PosCharNext
ConvertCaseUppercase
BlockOff
RETURN
LABEL(NotFnd)
DISPLAY(On!)
PROMPT("It's finished. Press ENTER to continue.")
PAUSE
PosDocTop
IF
Show Me An Example...
─────────────────────────────────────────────────────────────────
IF is the opening command of a IF-ENDIF conditional statement.
An IF statement permits the execution of a series of commands
only if certain conditions exist. The IF command contains a
relational expression that can be evaluated as true or false.
For example, NUMBER>28 is a relational expression that could be
either true or false depending on the value of variable NUMBER.
When an IF expression is true, the commands directly after IF are
executed. When an expression is false, the macro proceeds
directly to the ENDIF command and resumes. To execute certain
commands only when the IF expression is false, use ELSE.
Syntax: IF(Test)
Parameters: Test
A relational expression specifying the condition
to evaluate.
See Also: AND
ELSE
ENDIF
NOT
OR
XOR
──── ────For Example...
This macro prints the current document path and filename in a
footer.
IF(?Name<>"")
FooterB(Create!)
TYPE(?Path+?Name)
SubstructureExit
ELSE
PROMPT("The file hasn't been saved yet. Please save and re-run
the macro.")
PAUSE
ENDIF
INDIRECT
Show Me An Example...
─────────────────────────────────────────────────────────────────
INDIRECT returns the contents of the specified variable.
INDIRECT allows the variable name to be concatenated through any
combination of character expressions, numeric expressions, or
existing variables. This command is used in conjunction with
other commands such as IF or Type.
For Example:
S1="New York"
S2="Georgia"
S3="Oregon"
FORNEXT(A;1;3;1)
Type("The state of ")
Type(INDIRECT("S"+A))
Hardreturn
ENDFOR
In this example, INDIRECT creates the variable names S1, S2, and
S3 by concatenating the character expression "S" and the variable
A. The variable names have been created indirectly in the
FORNEXT loop to eliminate the need to request them individually.
Syntax: INDIRECT(Variable)
Parameters: Variable
A combination of character expressions, numeric
expressions, or variables specifying the variable
name.
See Also: ASSIGN
──── ────For Example...
This macro averages a series of numbers and returns the quotient
value of the average.
ASSIGN(Last;0)
GETNUMBER(HowMany;"How many numbers do you have to average")
ASSIGN(Y;0)
FORNEXT(Count;1;HowMany)
GETNUMBER(INDIRECT("Number"+Count);"Enter in a number ")
ASSIGN(last;last+Indirect("Number"+Count))
ENDFOR
Type("The quotient of the average of ")
FORNEXT(X;1;HowMany)
TYPE(Indirect("Number"+x)+"+")
ENDFOR
DeleteCharPrevious
Type(" is "+last DIV howmany)
INPUT
Show Me An Example...
─────────────────────────────────────────────────────────────────
INPUT displays a prompt, pausing the macro while the user enters
any necessary keystrokes. The macro remains paused until the
user presses Enter or the command specified in the last PAUSESET.
This command is similar to using PROMPT and PAUSE together.
However, the PROMPT message is removed from the screen as soon as
any key is pressed. INPUT is also similar to using STATUSPROMPT
and PAUSE together. However, the STATUSPROMPT message is removed
only by a blank STATUSPROMPT or by a blank INPUT.
Syntax: INPUT("Prompt")
Parameters: Prompt
A character expression specifying the prompt to
display.
See Also: INPUT
PAUSE
PAUSESET
PROMPT
STATUSPROMPT
──── ────For Example...
This macro prompts for a file to retrieve. It then calls a
Procedure to retrieve the file.
GLOBAL(Path;Filename)
LABEL(Begin)
GETSTRING(Path;"Enter the Path of the file to retrieve.")
GETSTRING(Filename;"Enter the filename to retrieve.")
Retrieve() //calls the procedure Retrieve
ERROR(Off!)
IF(?Name="")
GO(Begin)
ENDIF
QUIT
PROCEDURE Retrieve()
ONERROR CALL(Error)
FileRetrieve(Path+Filename)
ENDPROC
LABEL(Error)
INPUT("The File doesn't exist. Press Enter to continue")
RETURN
INTEGER
Show Me An Example...
─────────────────────────────────────────────────────────────────
INTEGER returns the integer portion of the specified numeric
expression. For example, INTEGER(43/2) returns the value of 21.
The fractional portion (0.5) is ignored. This command is
generally used in conjunction with such commands as IF, ASSIGN,
or Type.
Syntax: INTEGER(Number)
Parameters: Number
A numeric expression specifying the number to
evaluate. This numeric expression often contains
a mathematical operation such as division.
See Also: ASSIGN
IF
FRACTION
Type
──── ────For Example...
This macro prompts for a numerator followed by a denominator and
performs the division of the two numbers. The macro returns the
integer value of the nearest whole number.
DISPLAY(Off!)
GETNUMBER(num1;"Enter the numerator")
GETNUMBER(num2;"Enter the denominator")
x:=FRACTION(num1/num2)
y:=INTEGER(num1/num2)
IF(x>=0.5)
num:=y+1
ELSE
num:=y
ENDIF
Type(num)
LABEL
Show Me An Example...
─────────────────────────────────────────────────────────────────
LABEL marks a specific location, sometimes called a subroutine,
in a macro. Execution can be directed to that location from
anywhere in the macro using commands such as CALL, GO, ONCANCEL,
ONERROR, and ONNOTFOUND.
A macro can contain an unlimited number of LABEL commands, but
each label must have a unique name. Label names cannot include
spaces or be longer that thirty characters.
Syntax: LABEL(Label Name)
Parameters: Label Name
Specifies the label name. Although the name
usually consists of text, it is not considered a
character expression and should not be enclosed in
quotation marks.
See Also: CALL
GO
ONCANCEL
ONERROR
ONNOTFOUND
──── ────For Example...
This macro searches for a period (.) followed by two spaces and
capitalizes the first letter of the next sentence.
DISPLAY(Off!)
PosDocTop
CALL(Convert)
ONNOTFOUND(NotFnd)
LABEL(Begin)
SearchString(". ")
SearchNext
CALL(Convert)
GO(Begin)
LABEL(Convert)
BlockOn(CharMode!)
PosCharNext
ConvertCaseUppercase
BlockOff
RETURN
LABEL(NotFnd)
DISPLAY(On!)
PROMPT("It's finished. Press ENTER to continue.")
PAUSE
PosDocTop
LOCAL
Show Me An Example...
─────────────────────────────────────────────────────────────────
LOCAL is used to ensure that a variable is local to a FUNCTION,
PROCEDURE, or macro. Once the PROCEDURE or FUNCTION, or macro
has executed, the local variables are discarded from memory and
are no longer available.
Syntax: LOCAL(Var1;Var2;...VarN)
Parameters: Variable
Any variable is valid for this parameter.
See Also: DISCARD
FUNCTION
GLOBAL
PERSIST
PERSISTALL
PROCEDURE
──── ────For Example...
This macro executes a function from within a TYPE command.
Prmt:="Would you like to continue?"
Type ("You pressed "+YesNo(prmt))
//More code for the macro
Quit
FUNCTION YesNo (message)
LOCAL(ans)
IF (EXISTS(ans))
DISCARD(ans)
ENDIF
LABEL(Begin)
CHAR(ans;message+" Y/N")
SWITCH(TOLOWER(NTOC(ans)))
CASEOF "y" : ans:="Y"
CASEOF "n" : ans:="N"
DEFAULT : GO(Begin)
ENDSWITCH
RETURN(ans)
ENDFUNC
LOOK
Show Me An Example...
─────────────────────────────────────────────────────────────────
LOOK evaluates whether a key was pressed by the user. If a key
has been pressed, the numeric equivalent of the key is assigned
to the variable specified in the Variable parameter. If a key
has not been pressed, the contents of the variable is assigned
the value of 0 and the macro continues. LOOK is most useful in
macros that execute certain commands only if a specific key is
pressed. This command is used in conjunction with commands
designed to evaluate expressions such as SWITCH, IF, or REPEAT.
For a list of the keys and their numeric equivalents, see
Appendix A in the Appendices section.
Syntax: LOOK(Variable)
Parameters: Variable
Specifies the variable to contain the numeric
equivalent of the key.
See Also: SWITCH
IF
NTOC
REPEAT
──── ────For Example...
This macro counts keystrokes until the user presses Ctrl-Enter.
STATUSPROMPT("Press Ctrl+Enter to quit")
cnt:=0
REPEAT
LOOK(info)
IF((info<>0) AND (info<>-8097))
cnt:=cnt+1
Type(NTOC(info))
ENDIF
UNTIL(info=-8097)
STATUSPROMPT("")
PAUSESET(EndFieldKey)
PROMPT("You pressed "+cnt+" keystrokes. Press F9 to continue")
PAUSE
MENULIST
Show Me An Example...
─────────────────────────────────────────────────────────────────
MENULIST displays a dialog box containing the specified menu
items. The items displayed in the dialog box are numbered
automatically. The number of the item selected by the user is
assigned to the variable specified in the Variable parameter.
Once the variable has been assigned, it can be evaluated with
such commands as IF or SWITCH.
Syntax: MENULIST(Variable;{"Item1";"Item2";..."ItemN"};"Ti
tle";Horizontal Position;Vertical Position)
Parameters: Variable
Any variable is valid for this parameter. The
variable contains the number of the selected item.
Item
A character expression specifying the item.
Title (optional)
A character expression specifying the title of the
dialog box.
Horizontal Position (optional)
A numeric expression specifying the horizontal
position of the dialog box. If this parameter is
not specified, the dialog will be centered.
Vertical Position (optional)
A numeric expression specifying the vertical
position of the dialog box. If this parameter is
not specified, the dialog will be centered.
See Also: SWITCH
IF
──── ────For Example...
This macro displays a menu from which the user chooses to whom
they are writing a letter.
TYPE("Dear ")
MENULIST(choice;{"WordPerfect Corp";"Mom and Dad";"President of
the US"})
SWITCH(choice)
CASEOF 1 : Type("Customer Support")
CASEOF 2 : Type("Mom and Dad")
CASEOF 3 : Type("Mr. President")
ENDSWITCH
Type(",")
Hrt
Hrt
NEST
Show Me An Example...
─────────────────────────────────────────────────────────────────
NEST temporarily transfers control from the current macro to
another macro. The transfer occurs when this command is
encountered in the current macro. When the nested macro is
complete, control returns to the parent macro and continues.
Syntax: NEST("Macro")
Parameters: Macro
A character expression specifying the macro to
nest. The path and .WPM extension are optional.
See Also: CHAIN
──── ────For Example...
This macro nests a macro RTRN_ADD.WPM which types a users return
address. It then allows the user to fill in the inside address
and salutation.
NEST("rtrn_add.wpm")
Hrt
Hrt
STATUSPROMPT("Enter the inside address and press F9 to continue")
PAUSECOMMAND(EndField)
Hrt
Hrt
Type("Dear ")
STATUSPROMPT("Enter the salutation and press Enter")
PAUSE
STATUSPROMPT("")
Type(",")
Hrt
Hrt
NEXT
Show Me An Example...
─────────────────────────────────────────────────────────────────
NEXT executes the next cycle or iteration of a FORNEXT, FOREACH,
WHILE or REPEAT loop. Usually, the ENDFOR, ENDWHILE, or UNTIL
command ends the current iteration and directs execution to the
beginning of the loop to start the next iteration. NEXT sends
execution to the next iteration from a location other than at the
end of the loop. For example, you might use nested IF statements
as part of the loop and if a specific condition exists, NEXT
causes the remaining commands to be ignored and the loop proceeds
directly to the next iteration.
Syntax: NEXT
Parameters: None
See Also: BREAK
FORNEXT
FOREACH
REPEAT
WHILE
──── ────For Example...
This macro parses an array and displays the student name and
grade.
student[1]:="Mark B. PE 132 A"
student[2]:="Kerry R. Physics 305 B"
student[3]:="Ralph D. CS 351 A"
student[4]:="John B. Math 402 B"
FORNEXT(x;1;4;1)
len:=STRLEN(student[x])
namepos:=STRPOS(student[x];" ")
IF((len=0) OR (namepos=0))
NEXT
name:="xxx"
ENDIF
name:=SUBSTR(student[x];1;namepos-1)
grade:=SUBSTR(student[x];len;1)
Type(name)
FORNEXT(space;1;15-namepos;1)
Type(" ")
ENDFOR
Type(grade)
HRt
ENDFOR
NOT
Show Me An Example...
─────────────────────────────────────────────────────────────────
NOT is an operator that evaluates an expression in a conditional
statement and/or returns the complement of an expression. This
command performs a logical NOT. Use NOT when you want the
conditional statement to be evaluated as true only if the
complement of the expression is true, in other words, NOT true
means it is false. This operator is used in conjunction with
such commands as IF, REPEAT, and WHILE.
Syntax: NOT
Parameters: None
See Also: AND
IF
OR
REPEAT
WHILE
XOR
──── ────For Example...
This macro places the path and filename of the current document
in a header.
Header:=1=1
ONNOTFOUND CALL(Assign)
PosDocVeryTop
SearchString("[Header A]")
SearchNext()
NOTFOUND(Off!)
IF(NOT Header)
HeaderA(Create!)
ELSE
HeaderA(Edit!)
ENDIF
DeleteToEndOfLine
Type(?Path+?Name)
SubstructureExit
QUIT
LABEL(ASSIGN)
Header:=1=0
RETURN
NOTFOUND
Show Me An Example...
─────────────────────────────────────────────────────────────────
NOTFOUND determines whether to ignore a Not Found condition
during macro execution. A Not Found condition most commonly
occurs when a search fails. By default, Not Found conditions are
not ignored and will generally stop the macro. NOTFOUND can
also be used to redirect macro execution with ONNOTFOUND. If an
ONNOTFOUND command occurs in the macro before a Not Found
condition occurs, the macro is redirected to the label specified
by ONNOTFOUND.
Syntax: NOTFOUND(State)
Parameters: State
Specifies whether to ignore a Not Found. Select
an enumerated type or its numeric equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
Off! 0 Ignore Not Found
On! 1 Do not ignore Not
Found
═════════════════════════════════════════════════
See Also: ASSERT
?NotFound
ONNOTFOUND
──── ────For Example...
This macro places the path and filename of the current document
in a header.
Header:=1=1
ONNOTFOUND CALL(Assign)
PosDocVeryTop
SearchString("[Header A]")
SearchNext()
NOTFOUND(Off!)
IF(NOT Header)
HeaderA(Create!)
ELSE
HeaderA(Edit!)
ENDIF
DeleteToEndOfLine
Type(?Path+?Name)
SubstructureExit
QUIT
LABEL(ASSIGN)
Header:=1=0
RETURN
NTOC
Show Me An Example...
─────────────────────────────────────────────────────────────────
NTOC (Number To Character) converts a WordPerfect key value or
character set number to its character equivalent. The number is
equal to the character number multiplied by 256 plus the
character number. For example, Ç is character 38 in Character
Set 1. Multiply 256 times 1 (256), then add 38 (294). The NTOC
of 294 is Ç. NTOC returns an empty string ("") if a number is
used which has no character equivalent.
Syntax: NTOC(Number)
Parameters: Number
A numeric expression specifying the number to
convert.
See Also: CTON
──── ────For Example...
This macro creates a secondary merge file through a series of
prompts.
ASSIGN(More;"Y")
WHILE(TOUPPER(More)="Y")
FOREACH(field;{"First Name";"Last
Name";"Company";"Address";"City";"State";"Zip"})
GETSTRING(info;"Enter the "+field;"Field "+field;)
TYPE(info)
EndField
info:=""
ENDFOR
MergeCode(EndRecord!)
CHAR(More;"Enter another record? Y/N")
ASSIGN(More;NTOC(More))
ENDWHILE
NUMSTR
Show Me An Example...
─────────────────────────────────────────────────────────────────
NUMSTR converts a numeric expression or a measurement expression
to a character expression. Numbers converted with NUMSTR are
regarded as text by the macro. This command is used in
conjunction with commands that evaluates expressions such as
ASSIGN or Type.
Syntax: NUMSTR(Number;Right Digits;Left Digits)
Parameters: Number
A numeric or measurement expression specifying the
number to convert.
Right Digits (optional)
A numeric expression specifying the number of
digits right of the decimal.
Left Digits (optional)
A numeric expression specifying the number of
digits left of the decimal.
See Also: STRNUM
──── ────For Example...
This macro defines page numbering in the form Current of Total (1
of 5).
DISPLAY(Off!)
PosDocBottom
TotPgNum:=?page
PosDocTop
TotPgStr:=NUMSTR(TotPgNum)
PageNumberPosition(BottomCenter!;UseDefaultValues!)
PageNumberFormat("[page #] of "+TotPgStr)
ONCANCEL
Show Me An Example...
─────────────────────────────────────────────────────────────────
ONCANCEL directs macro execution to the specified LABEL command
when a Cancel occurs. If an ONCANCEL command has not been
encountered when a Cancel occurs, the macro will stop. If a
Cancel occurs after two or more ONCANCEL commands, the macro is
directed to the LABEL command specified in the last encountered
ONCANCEL command in the active macro.
ONCANCEL also includes the option of calling a LABEL if you use
ONCANCEL CALL. This option of ONCANCEL can also call a
PROCEDURE. If you call a LABEL, include a RETURN command at the
end of the commands to be executed by the specified LABEL. This
returns the macro execution to the command immediately following
the command most recently executed when the Cancel occurred.
Syntax: ONCANCEL(Label)
or
ONCANCEL CALL (Label)
Parameters: Label
The label must correspond to a LABEL command
within the macro. If using ONCANCEL CALL, this
parameter can be a PROCEDURE.
See Also: ASSERT
LABEL
ONERROR
ONNOTFOUND
PROCEDURE
RETURN
──── ────For Example...
This macro constantly prompts for a name until Cancel is pressed.
ONCANCEL CALL(Cancel)
LABEL(Top)
Name:=""
GETSTRING(Name;"Type in a name, (Cancel or Enter) to
quit";"Name")
IF(Name="")
ASSERT(CancelCondition!)
ENDIF
TYPE(Name)
HRt
GO(Top)
LABEL(Cancel)
CANCEL(Off!)
CHAR(Selection;"Do you really want to Quit? Y/N")
SWITCH(TOLOWER(NTOC(Selection)))
CASEOF "y" : QUIT
CASEOF "n" : CANCEL(On!) RETURN
DEFAULT : GO(Cancel)
ENDSWITCH
ONERROR
Show Me An Example...
─────────────────────────────────────────────────────────────────
ONERROR directs macro execution to the specified LABEL command
when an Error occurs. If ONERROR has not been encountered when
an Error occurs, the macro will stop. If an Error occurs after
two or more ONERROR commands, the macro is directed to the LABEL
command specified in the last encountered ONERROR command in the
active macro.
ONERROR also includes the option of calling a LABEL if you use
ONERROR CALL. This option of ONERROR can also call a PROCEDURE.
If you call a LABEL, include a RETURN command at the end of the
commands to be executed by the specified LABEL. This will return
the macro execution to the command immediately following the
command most recently executed when the Error occurred.
Syntax: ONERROR(Label)
or
ONERROR CALL (Label)
Parameters: Label
The label must correspond to a LABEL command
within the macro. If using ONERROR CALL, this
parameter can be a PROCEDURE.
See Also: ASSERT
LABEL
ONCANCEL
ONNOTFOUND
PROCEDURE
RETURN
──── ────For Example...
This macro prompts the user to highlight text in a document, and
the macro assigns it to a variable.
Display(On!)
ONERROR(error)
LABEL(Begin)
BlockKey
PROMPT("Highlight the text to assign to a variable and press
Enter")
PAUSE
x:=?BlockedText
IF (x="")
ASSERT(ErrorCondition!)
ENDIF
//the user must place more code here to make
QUIT //this macro more functional
LABEL(Error)
BEEP
DisplayRewrite
PROMPT("You must select text to assign it to a variable")
PAUSE
GO(Begin)
ONNOTFOUND
Show Me An Example...
─────────────────────────────────────────────────────────────────
ONNOTFOUND directs macro execution to a specified LABEL command
when a Not Found condition occurs. Macro execution is directed
to the LABEL command specified in the last encountered ONNOTFOUND
command. If an ONNOTFOUND command has not been encountered when
a Not Found condition occurs, the macro will stop.
ONNOTFOUND also includes the option of calling a LABEL if you use
ONNOTFOUND CALL. This option of ONNOTFOUND can also call a
PROCEDURE. If you call a LABEL, include a RETURN command at the
end of the commands to be executed by the specified LABEL. This
will return the macro execution to the command immediately
following the command most recently executed when the Not Found
occurred.
Syntax: ONNOTFOUND(Label)
or
ONNOTFOUND CALL (Label)
Parameters: Label
The label must correspond to a LABEL command
within the macro. If using ONNOTFOUND CALL, this
parameter can be a PROCEDURE.
See Also: ASSERT
LABEL
ONCANCEL
ONERROR
PROCEDURE
RETURN
──── ────For Example...
This macro searches for a period (.) followed by two spaces and
capitalizes the first letter of the next sentence.
DISPLAY(Off!)
PosDocTop
CALL(Convert)
ONNOTFOUND(NotFnd)
LABEL(Begin)
SearchString(". ")
SearchNext
CALL(Convert)
GO(Begin)
LABEL(Convert)
BlockOn(CharMode!)
PosCharNext
ConvertCaseUppercase
BlockOff
RETURN
LABEL(NotFnd)
DISPLAY(On!)
PROMPT("It's finished. Press ENTER to continue.")
PAUSE
PosDocTop
OR
Show Me An Example...
─────────────────────────────────────────────────────────────────
OR is an operator that evaluates at least two expressions in a
conditional statement. Conditional statements are created with
commands such as IF, REPEAT, and WHILE. This operator performs a
logical OR that evaluates a conditional statement as true if at
least one expression is true.
Parameters: None
See Also: AND
DIV
IF
NOT
REPEAT
WHILE
XOR
──── ────For Example...
This macro parses an array and displays the student name and
grade.
student[1]:="Mark B. PE 132 A"
student[2]:="Kerry R. Physics 305 B"
student[3]:="Ralph D. CS 351 A"
student[4]:="John B. Math 402 B"
FORNEXT(x;1;4;1)
len:=STRLEN(student[x])
namepos:=STRPOS(student[x];" ")
IF((len=0) OR (namepos=0))
NEXT
name:="xxx"
ENDIF
name:=SUBSTR(student[x];1;namepos-1)
grade:=SUBSTR(student[x];len;1)
Type(name)
FORNEXT(space;1;15-namepos;1)
Type(" ")
ENDFOR
Type(grade)
HRt
ENDFOR
PAUSE
Show Me An Example...
─────────────────────────────────────────────────────────────────
PAUSE pauses a macro until Enter is pressed while in a document
or the command specified in PAUSESET is pressed. This command
enables the user to type text or press keystrokes as if there
were no macro running. PAUSE does not prompt the user so this
command is generally used in conjunction with PROMPT,
STATUSPROMPT, or BEEP.
Syntax: PAUSE
Parameters: None
See Also: BEEP
PAUSECOMMAND
PAUSEKEY
PAUSESET
PROMPT
STATUSPROMPT
──── ────For Example...
This macro searches for a period (.) followed by two spaces and
capitalizes the first letter of the next sentence.
DISPLAY(Off!)
PosDocTop
CALL(Convert)
ONNOTFOUND(NotFnd)
LABEL(Begin)
SearchString(". ")
SearchNext
CALL(Convert)
GO(Begin)
LABEL(Convert)
BlockOn(CharMode!)
PosCharNext
ConvertCaseUppercase
BlockOff
RETURN
LABEL(NotFnd)
DISPLAY(On!)
PROMPT("It's finished. Press ENTER to continue.")
PAUSE
PosDocTop
PAUSECOMMAND
Show Me An Example...
─────────────────────────────────────────────────────────────────
PAUSECOMMAND pauses a macro until the user executes the specified
command. PAUSECOMMAND does not prompt the user, so this command
is generally used in conjunction with PROMPT, STATUSPROMPT, or
BEEP.
Syntax: PAUSECOMMAND(Command)
Parameters: Command
A macro command specifying the command to end the
pause. Any product command is valid for this
parameter, but a command such as HardReturn would
be the most common.
See Also: BEEP
PAUSE
PAUSEKEY
PAUSESET
PROMPT
STATUSPROMPT
──── ────For Example...
This macro nests a macro RTRN_ADD which types a users return
address. It then allows the user to fill in the inside address
and salutation.
NEST("rtrn_add.wpm")
Hrt
Hrt
STATUSPROMPT("Enter the inside address and press F9 to continue")
PAUSECOMMAND(EndField)
Hrt
Hrt
Type("Dear ")
STATUSPROMPT("Enter the salutation and press Enter")
PAUSE
STATUSPROMPT("")
Type(",")
Hrt
Hrt
PAUSEKEY
Show Me An Example...
─────────────────────────────────────────────────────────────────
PAUSEKEY pauses a macro until the specified key is pressed.
PAUSEKEY does not prompt the user so this command is generally
used in conjunction with PROMPT, STATUSPROMPT, or BEEP.
Syntax: PAUSEKEY(Key Name)
Parameters: Key Name
Specifies the key to end the pause. There are
specific key names assigned to each key. For a
list of the key names see Appendix B in the
Appendices section.
See Also: BEEP
PAUSE
PAUSECOMMAND
PAUSESET
PROMPT
STATUSPROMPT
──── ────For Example...
This macro beeps if the current document is blank and displays a
message.
DISPLAY(Off!)
IF(?DocBlank)
BEEP
DISPLAY(On!)
PROMPT("The document is blank. Press Tab to continue")
PAUSEKEY(TabKey)
DISPLAY(Off!)
QUIT
ENDIF
PAUSESET
Show Me An Example...
─────────────────────────────────────────────────────────────────
PAUSESET specifies the default key for PAUSE and INPUT. The key
specified in PAUSESET replaces a hardreturn as the command to end
a pause.
Syntax: PAUSESET(Command)
Parameters: Command
A macro command specifying the command to end the
pause. Any product command is valid for this
parameter, but a command such as HardReturn would
be the most common.
See Also: INPUT
PAUSE
PAUSECOMMAND
PAUSEKEY
──── ────For Example...
This macro counts keystrokes until the user presses Ctrl-Enter.
STATUSPROMPT("Press Ctrl+Enter to quit")
cnt:=0
REPEAT
LOOK(info)
IF((info<>0) AND (info<>-8097))
cnt:=cnt+1
Type(NTOC(info))
ENDIF
UNTIL(info=-8097)
STATUSPROMPT("")
PAUSESET(EndFieldKey)
PROMPT("You pressed "+cnt+" keystrokes. Press F9 to continue")
PAUSE
PERSIST
Show Me An Example...
─────────────────────────────────────────────────────────────────
PERSIST allows the specified variables to be recognized and
accessed by other macros, FUNCTIONS, PROCEDURES, and merges.
Normally, variables are only recognized, and can only be used, by
the macro in which they are defined. PERSIST allows variables to
be shared among macros during the present session of WordPerfect.
Variables Var0 through Var9 persist automatically. All other
variables require this command to persist.
Syntax: PERSIST(Variable1;Variable2;...VariableN)
Parameters: Variable
Any variable is valid for this parameter.
See Also: ASSIGN
DISCARD
GLOBAL
LOCAL
PERSISTALL
──── ────For Example...
This macro assigns the typist's initials to a variable and makes
it accessible until WordPerfect is exited.
GetString(init;"Enter the typist's initials.")
IF(EXISTS(init))
PERSIST(init) //The variable INIT is now accessible in any
macro
ENDIF //and/or merge as long as WordPerfect is not
exited. Access it through a merge with the
VARIABLE command, and access it through a macro
with a TYPE command.
PERSISTALL
Show Me An Example...
─────────────────────────────────────────────────────────────────
PERSISTALL allows all variables in the current macro to be
recognized and accessed by other macros, FUNCTIONS, PROCEDURES,
and merges during the present session of WordPerfect. This
command takes effect when it is encountered, so only those
variables defined after this command will be available to other
macros. Variables Var0 through Var9 persist automatically.
Syntax: PERSISTALL
Parameters: None
See Also: ASSIGN
DISCARD
GLOBAL
LOCAL
PERSIST
──── ────For Example...
This macro prompts the user for a return address and assigns it
to a series of variables. It then makes the variables accessible
until WordPerfect is exited.
DLGCREATE(x;"Return Address";DLGNoCancel!;;;50;10)
DLGCONTROL(CtrlText!;name;"Name";StyInitial!;1;3;37;2)
DLGCONTROL(CtrlText!;address;"Street Address";;1;5;27;2)
DLGCONTROL(CtrlText!;c;"City, State ZIP ";;1;7;25;2)
DLGEND
PERSISTALL
Prompt("All the variables are now accessible in any
macro/merge.")
WAIT(50)
PRESSKEY
Show Me An Example...
─────────────────────────────────────────────────────────────────
PRESSKEY executes the specified keystroke. Normally, PRESSKEY
will execute the original function of a key even if the key has
been remapped. If a key has been remapped through Keyboard
Layout, you can use PRESSKEY in conjunction with the ?KeyPressed
system variable to execute the new function of the key. For the
list of keys and their numeric equivalents see Appendix A in the
Appendices section.
Syntax: PRESSKEY(Key Value)
Parameters: Key Value
A numeric expression specifying the numeric
equivalent of the keystroke to execute. This
parameter can also contain the ?KeyPressed system
variable.
See Also: CHAR
LOOK
──── ────For Example...
This macro takes the number returned by the CHAR command and
presses the corresponding key.
CHAR(x;"Enter a character: ")
Type("You pressed ")
PRESSKEY(x)
PROCEDURE
Show Me An Example...
─────────────────────────────────────────────────────────────────
PROCEDURE is the opening command for a PROCEDURE-ENDPROC
definition. A PROCEDURE is a subroutine to which you can pass
information. Unlike a FUNCTION, a PROCEDURE cannot return
information. PROCEDURE defines the procedure name and the
parameter names, and precedes the series of commands to be
executed when the PROCEDURE is called. Commands after an ENDPROC
are ignored, so all PROCEDUREs should be placed at the end of a
macro.
Creating and calling a PROCEDURE is much like calling a LABEL.
However, unlike a LABEL, information can be passed to the
PROCEDURE to customize the procedure operation. If variables are
used in the PROCEDURE, they must first be made available to the
PROCEDURE using GLOBAL or PERSIST. If variables are only to be
used in the PROCEDURE, use LOCAL in the PROCEDURE definition.
To call a PROCEDURE, you simply state the procedure name and fill
in the parameters. The parameters can contain any expression,
including variables. You must pass the same number of parameters
as originally defined in the PROCEDURE. Since a PROCEDURE cannot
return information, it should not be called from within another
command or conditional statement. Also, a PROCEDURE cannot be
called from within another PROCEDURE.
PROCEDUREs can be in the macro from which they are called, in
another macro, or they can be combined into a macro file library.
This library is a macro that doesn't execute, but simply contains
PROCEDUREs that may be useful in many macros. If a PROCEDURE
isn't defined in the macro that calls it, the USE command must be
placed in the calling macro to identify which macro contains the
PROCEDURE. If you are storing PROCEDUREs in a macro file
library, the file must be compiled before it can be used. To
compile, simply play the macro.
Syntax: PROCEDURE
ProcedureName(Parameter1;Parameter2;...ParN)
Parameters: Procedure Name
Specifies the PROCEDURE name. Although this
parameter is usually text, it is not considered a
character expression and should not be in quotes.
Parameter (optional)
Specifies the parameter names to which information
will be passed when the PROCEDURE is called. If
no parameters are specified, the PROCEDURE can
still be called and executed.
See Also: ENDPROC
FUNCTION
GLOBAL
LOCAL
PERSIST
USE
──── ────For Example...
This macro prompts for a file to retrieve. It then calls a
Procedure to retrieve the file.
GLOBAL(Path;Filename)
LABEL(Begin)
GETSTRING(Path;"Enter the Path of the file to retrieve.")
GETSTRING(Filename;"Enter the filename to retrieve.")
Retrieve() //calls the procedure Retrieve
ERROR(Off!)
IF(?Name="")
GO(Begin)
ENDIF
QUIT
PROCEDURE Retrieve()
ONERROR CALL(Error)
FileRetrieve(Path+Filename)
ENDPROC
LABEL(Error)
INPUT("The File doesn't exist. Press Enter to continue")
RETURN
PROMPT
Show Me An Example...
─────────────────────────────────────────────────────────────────
PROMPT displays a temporary prompt on the status line. The
prompt is removed when a key is pressed, or the display is
rewritten. PROMPT does not pause the macro, so it is usually
used with PAUSE or WAIT.
Syntax: PROMPT("Prompt")
Parameters: Prompt
A character expression specifying the prompt.
See Also: BEEP
PAUSE
STATUSPROMPT
WAIT
──── ────For Example...
This macro searches for a period (.) followed by two spaces and
capitalizes the first letter of the next sentence.
DISPLAY(Off!)
PosDocTop
CALL(Convert)
ONNOTFOUND(NotFnd)
LABEL(Begin)
SearchString(". ")
SearchNext
CALL(Convert)
GO(Begin)
LABEL(Convert)
BlockOn(CharMode!)
PosCharNext
ConvertCaseUppercase
BlockOff
RETURN
LABEL(NotFnd)
DISPLAY(On!)
PROMPT("It's finished. Press ENTER to continue.")
PAUSE
PosDocTop
QUIT
Show Me An Example...
─────────────────────────────────────────────────────────────────
QUIT stops a macro. No commands following it are executed. If
the current macro was started by another macro, both macros stop.
Chained or nested macros will not execute after QUIT occurs.
Syntax: QUIT
Parameters: None
──── ────For Example...
This macro constantly prompts for a name until Cancel is pressed.
ONCANCEL CALL(Cancel)
LABEL(Top)
Name:=""
GETSTRING(Name;"Type in a name, (Cancel or Enter) to
quit";"Name")
IF(Name="")
ASSERT(CancelCondition!)
ENDIF
TYPE(Name)
HRt
GO(Top)
LABEL(Cancel)
CANCEL(Off!)
CHAR(Selection;"Do you really want to Quit? Y/N")
SWITCH(TOLOWER(NTOC(Selection)))
CASEOF "y" : QUIT
CASEOF "n" : CANCEL(On!) RETURN
DEFAULT : GO(Cancel)
ENDSWITCH
REPEAT
Show Me An Example...
─────────────────────────────────────────────────────────────────
REPEAT is the opening command of a REPEAT-UNTIL conditional loop.
A REPEAT-UNTIL loop continues to execute all commands between
REPEAT and UNTIL until the condition set in UNTIL is true. Since
the condition is evaluated at the end, a REPEAT-UNTIL loop always
executes at least once regardless of whether the UNTIL condition
is true or false. For information on conditional loops whose
test expressions are evaluated at the top of the loop, see WHILE
and ENDWHILE.
Syntax: REPEAT
Parameters: There are no parameters, but REPEAT is always
followed by commands to execute at least once.
See Also: ENDWHILE
UNTIL
WHILE
──── ────For Example...
This macro counts keystrokes until the user presses Ctrl-Enter.
STATUSPROMPT("Press Ctrl+Enter to quit")
cnt:=0
REPEAT
LOOK(info)
IF((info<>0) AND (info<>-8097))
cnt:=cnt+1
Type(NTOC(info))
ENDIF
UNTIL(info=-8097)
STATUSPROMPT("")
PAUSESET(EndFieldKey)
PROMPT("You pressed "+cnt+" keystrokes. Press F9 to continue")
PAUSE
RETURN
Show Me An Example...
─────────────────────────────────────────────────────────────────
RETURN marks the end of a series of commands initiated by LABEL,
PROCEDURE, or FUNCTION. This command is usually used in
conjunction with CALL. When RETURN is encountered, macro
execution returns to the command immediately following the
command that called the LABEL or PROCEDURE. If RETURN occurs
within a FUNCTION, it also has the capability of returning
information from the FUNCTION to the location from which it was
called. RETURN is then followed by an expression enclosed in
parentheses. The expression contains the value to return to the
FUNCTION.
Syntax: RETURN or RETURN(Expression)
Parameters: Expression
Any expression is valid for this parameter. It is
often a variable or a parameter name as defined by
the FUNCTION to which it is returning.
See Also: CALL
FUNCTION
LABEL
ONCANCEL
ONERROR
ONNOTFOUND
PROCEDURE
──── ────For Example...
This macro executes a function from within a TYPE command.
Prmt:="Would you like to continue?"
Type ("You pressed "+YesNo(prmt))
//More code for the macro
Quit
FUNCTION YesNo (message)
LOCAL(ans)
IF (EXISTS(ans))
DISCARD(ans)
ENDIF
LABEL(Begin)
CHAR(ans;message+" Y/N")
SWITCH(TOLOWER(NTOC(ans)))
CASEOF "y" : ans:="Y"
CASEOF "n" : ans:="N"
DEFAULT : GO(Begin)
ENDSWITCH
RETURN(ans)
ENDFUNC
RUNUNATTENDED
─────────────────────────────────────────────────────────────────
RUNUNATTENDED allows a macro to continue running even if it
encounters a situation that requires user input. Specifically,
retrieving a password-protected file or trying to read from a
disk drive not containing a disk both give error messages
requiring action from the user. Normally, each of these
situations will return an error that suspends macro execution
until the user responds. However, if RUNUNATTENDED is used, the
situation is canceled (no response is necessary) and macro
execution can be redirected with ONERROR. Without RUNUNATTENDED,
the macro is suspended until the user responds to the problem.
Syntax: RUNUNATTENDED(State)
Parameters: State
Specifies whether critical problems are canceled.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
Off! 0 Critical problems are
not canceled; response
required
On! 1 Critical problems are
canceled; no response
required
═════════════════════════════════════════════════
See Also: ONERROR
──── ────
SAVESTATE
Show Me An Example...
─────────────────────────────────────────────────────────────────
SAVESTATE saves the current state of certain WordPerfect features
and returns back to that state should a macro change it.
SAVESTATE automatically saves the state of Autocode Placement,
Replace Confirm, and WP51 Cursor Movement.
Syntax: SAVESTATE
Parameters: None
──── ────For Example...
This macro prompts for and sets top and bottom margins.
SAVESTATE
AutoCodePlacement(On!)
SetupSave
GETUNITS(margint;"Enter top margin";"Margin")
GETUNITS(marginb;"Enter bottom margin";"Margin")
MarginTop(margint)
MarginBottom(marginb)
SHELLASSIGN
Show Me An Example...
─────────────────────────────────────────────────────────────────
SHELLASSIGN assigns an expression to a Shell variable to be used
in a Shell macro.
Syntax: SHELLASSIGN(Variable;Expression)
Parameters: Variable
Specifies the name of the variable to be assigned.
Any variable name is valid for this parameter.
Expression
Specifies the expression to assign to the
variable. All expressions are valid for this
parameter.
See Also: SHELLMACRO
SHELLVARIABLE
──── ────For Example...
This macro takes a shell variable and retrieves the respective
file. The macro then places the path and filename in a footer,
re-assigns the shell variable and runs a shell macro named
WPPRINT.SHM.
WPVar:=SHELLVARIABLE(Name)
FileRetrieve(WPVar)
FooterB(Create!)
Type(?Path+?Name)
SubstructureExit
path:=?path
FileSave(Path+"WP.PRN")
SHELLASSIGN(Name;"WP.PRN")
SHELLMACRO("C:\OFFICE4\MACROS\WPPRINT.SHM")
SHELLMACRO
Show Me An Example...
─────────────────────────────────────────────────────────────────
SHELLMACRO runs the specified Shell macro at the point this
command is encountered. An .SHM extension is not required, and
the path is necessary only if the macro is not located in the
directory specified in the Location of Macro Files in Shell
Setup.
Syntax: SHELLMACRO("Macro")
Parameters: Macro
A character expression specifying the Shell macro
to run.
See Also: SHELLASSIGN
SHELLVARIABLE
──── ────For Example...
See example for SHELLASSIGN
SHELLVARIABLE
Show Me An Example...
─────────────────────────────────────────────────────────────────
SHELLVARIABLE returns the contents of a Shell variable. Variable
contents can either be typed, evaluated, or assigned to a
WordPerfect variable.
Syntax: SHELLVARIABLE(Variable)
Parameters: Variable
Specifies the name of the Shell variable.
See Also: ASSIGN
SHELLASSIGN
SHELLMACRO
Type
──── ────For Example...
See example for SHELLASSIGN
SHOWATTROFF
Show Me An Example...
─────────────────────────────────────────────────────────────────
SHOWATTROFF turns off a character display attribute. This
command is used in conjunction with SHOWTEXT to change the
display attributes.
Syntax: SHOWATTROFF(Attribute)
Parameters: Attribute
Specifies the display attribute to turn off.
SHOWATTROFF requires at least one Attribute
parameter, but will accept as many as need to be
turned off. Select an enumerated type or its
numeric equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
ExtraLarge! 0 Turns off Extra
Large
VeryLarge! 1 Turns off Very
Large
Large! 2 Turns off
Large
Small! 3 Turns off
Small
Fine! 4 Turns off Fine
Superscript! 5 Turns off
Superscript
Subscript! 6 Turns off
Subscript
Outline! 7 Turns off Outline
Italics! 8 Turns off Italics
Shadow! 9 Turns off Shadow
Redline! 10 Turns off Redline
DoubleUnderline! 11 Turns off
Double
Underline
Bold! 12 Turns off Bold
Strikeout! 13 Turns off
Strikeout
Underline! 14 Turns off
Underline
SmallCaps! 15 Turns off Small
Caps
Every! 16 Turns off
every display
attribute
═════════════════════════════════════════════════
See Also: SHOWATTRON
SHOWCODE
SHOWCOLOR
SHOWPOSITION
SHOWTEXT
──── ────For Example...
This macro displays a menu created with the Show commands.
SHOWPOSITION(0; -1)
SHOWCODE(ReverseOff!)
SHOWCOLOR(On!)
SHOWCODE(ClrScreen!)
SHOWPOSITION(21;8) SHOWTEXT("╔══════════════════════════╗")
SHOWPOSITION(21;9) SHOWTEXT("║ Please select the ║")
SHOWPOSITION(21;10) SHOWTEXT("║ desired recipient ║")
SHOWPOSITION(21;11) SHOWTEXT("║ ")
SHOWATTRON(Bold!) SHOWTEXT("1") SHOWATTROFF(Bold!)
SHOWTEXT(". ") SHOWATTRON(Bold!) SHOWTEXT("F")
SHOWATTROFF(Bold!) SHOWTEXT("red") SHOWTEXT(" ║")
SHOWPOSITION(21;12) SHOWTEXT("║ ")
SHOWATTRON(Bold!) SHOWTEXT("2") SHOWATTROFF(Bold!)
SHOWTEXT(". ") SHOWATTRON(Bold!) SHOWTEXT("M")
SHOWATTROFF(Bold!) SHOWTEXT("ary") SHOWTEXT(" ║")
SHOWPOSITION(21;13) SHOWTEXT("║ ║")
SHOWPOSITION(21;14) SHOWTEXT("╚══════════════════════════╝")
SHOWPOSITION(1; 24)
CHAR(menu1;"Selection: ")
DisplayRewrite
SHOWATTRON
Show Me An Example...
─────────────────────────────────────────────────────────────────
SHOWATTRON turns on a character display attribute. This command
is used in conjunction with SHOWTEXT to change the display
attributes of text being displayed.
Syntax: SHOWATTRON(Attribute;Attribute;...Atr)
Parameters: Attribute
Specifies the display attribute to turn on.
SHOWATTRON requires at least one Attribute
parameter, but will accept as many as need to be
turned on. Select an enumerated type or its
numeric equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
ExtraLarge! 0 Turns on Extra
Large
VeryLarge! 1 Turns on Very
Large
Large! 2 Turns on Large
Small! 3 Turns on Small
Fine! 4 Turns on Fine
Superscript! 5 Turns on
Superscript
Subscript! 6 Turns on
Subscript
Outline! 7 Turns on Outline
Italics! 8 Turns on Italics
Shadow! 9 Turns on Shadow
Redline! 10 Turns on Redline
DoubleUnderline! 11 Turns on
Double
Underline
Bold! 12 Turns on Bold
Strikeout! 13 Turns on
Strikeout
Underline! 14 Turns on
Underline
SmallCaps! 15 Turns on Small
Caps
Every! 16 Turns on every
display
attribute
═════════════════════════════════════════════════
See Also: SHOWATTROFF
SHOWCODE
SHOWCOLOR
SHOWPOSITION
SHOWTEXT
──── ────For Example...
See example for SHOWATTROFF
SHOWCODE
Show Me An Example...
─────────────────────────────────────────────────────────────────
SHOWCODE positions displayed text and allows for other display
changes. A SHOWCODE command affects the next occurence of a
SHOWTEXT command in the macro.
Syntax: SHOWCODE(Code)
Parameters: Code
Specifies the display change. Select an
enumerated type or its numeric equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
PosHome! 0 Displays text at
upper left of
document window
PosNextLine! 1 Displays text
on the next
line
PosBegLine! 2 Displays text at
the beginning of
the current line
PosLeft! 3 Moves back to the
last SHOWTEXT
PosRight! 4 Displays text
two spaces to
the right of
the last
SHOWTEXT
PosUp! 5 Displays text
one line up
from the last
SHOWTEXT
PosDown! 6 Displays text one
line down from
the last SHOWTEXT
ClrLine! 7 Clears the line
from the end of
the last SHOWTEXT
ClrScreen! 8 Clears the screen
AttrNormal! 9 Clears all
attributes
AttrMnemonic! 10 Turns on the
Mnemonic
attribute for
the next
character
ReverseOn! 11 Turns on Reverse
Video
ReverseOff! 12 Turns off Reverse
Video
SaveScreen! 13 Saves the screen
RestoreScreen! 14 Restores the
screen
═════════════════════════════════════════════════
See Also: SHOWATTROFF
SHOWATTRON
SHOWCOLOR
SHOWPOSITION
SHOWTEXT
──── ────For Example...
See example for SHOWATTROFF
SHOWCOLOR
Show Me An Example...
─────────────────────────────────────────────────────────────────
SHOWCOLOR turns a color scheme on or off.
Syntax: SHOWCOLOR(State;"Scheme Name")
Parameters: State
Specifies whether the color scheme is on or off.
Select an enumerated type or its numeric
equivalent
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
Off! 0 Turns off color
scheme
On! 1 Turns on color
scheme
═════════════════════════════════════════════════
Scheme Name (optional)
A character expression specifying the scheme name
to turn on. This parameter is not required when
turning a scheme off.
See Also: SHOWATTROFF
SHOWATTRON
SHOWCODE
SHOWPOSITION
SHOWTEXT
──── ────For Example...
See example for SHOWATTROFF
SHOWPOSITION
Show Me An Example...
─────────────────────────────────────────────────────────────────
SHOWPOSITION positions the cursor on the screen and, optionally,
displays a temporary prompt. SHOWPOSITION does not pause the
macro, so it is used in conjunction with such commands as PAUSE
or WAIT.
Syntax: SHOWPOSITION(Horizontal Position;Vertical
Position;"Prompt")Parameters: Horizontal
Position
A numeric expression specifying the horizontal
position of the prompt. This position is measured
in columns, with 0 representing the first column
at the left of the screen.
Vertical Position
A numeric expression specifying the vertical
position of the prompt. This position is measured
in lines, with 0 representing the first row at the
top of the screen.
Prompt (optional)
A character expression specifying the prompt to
display.
See Also: PAUSE
SHOWATTROFF
SHOWATTRON
SHOWCODE
SHOWCOLOR
SHOWTEXT
WAIT
──── ────For Example...
See example for SHOWATTROFF
SHOWTEXT
Show Me An Example...
─────────────────────────────────────────────────────────────────
SHOWTEXT displays a temporary prompt a specified number of times.
SHOWPOSITION does not pause the macro, so it is used in
conjunction with commands such as PAUSE or WAIT.
Syntax: SHOWTEXT("Prompt";Count)
Parameters: Prompt
A character expression specifying the prompt to
display.
Count (optional)
A numeric expression specifying the number of
times to display the prompt. If this parameter is
not specified, the prompt will display once.
See Also: PAUSE
SHOWATTROFF
SHOWATTRON
SHOWPOSITION
SHOWCODE
SHOWCOLOR
WAIT
──── ────For Example...
See example for SHOWATTROFF
SPEED
Show Me An Example...
─────────────────────────────────────────────────────────────────
SPEED slows down macro execution while writing to the screen.
Macro speed is incremented in tenths of a second. For example,
to specify a macro to wait one-half second, the command is
SPEED(5). The maximum delay is one minute or SPEED(600). The
default macro speed is SPEED(0). SPEED is useful for debugging
macros or making demonstration macros.
Syntax: SPEED(Tenths of a Second)
Parameters: Tenths of a Second
A numeric expression between 0 and 600 specifying
macro speed.
See Also: PAUSE
WAIT
──── ────For Example...
This macro displays how the SPEED command slows down the
execution of a macro.
FORNEXT(Count;1;20)
TYPE("This is line "+Count+".")
HRt
ENDFOR
SPEED(30)
FORNEXT(Count;1;20)
TYPE("This is line "+Count+".")
HRt
ENDFOR
STATUSPROMPT
Show Me An Example...
─────────────────────────────────────────────────────────────────
STATUSPROMPT displays a prompt on the status line. The prompt is
stored in memory much like a variable and will continue to
display until it is replaced by another prompt using either INPUT
or another STATUSPROMPT command. If the prompt is not replaced,
it will remain visible until it is cleared by a blank INPUT or
STATUSPROMPT or until you exit WordPerfect. STATUSPROMPT does
not pause the macro. To pause the macro until a specific key or
command is executed, use PAUSE, PAUSECOMMAND, or PAUSEKEY. To
display the prompt for a specific amount of time, use WAIT.
Syntax: STATUSPROMPT("Prompt")
Parameters: Prompt
A character expression specifying the prompt to
display.
See Also: PAUSE
PAUSECOMMAND
PAUSEKEY
WAIT
──── ────For Example...
This macro counts keystrokes until the user presses Ctrl-Enter.
STATUSPROMPT("Press Ctrl+Enter to quit")
cnt:=0
REPEAT
LOOK(info)
IF((info<>0) AND (info<>-8097))
cnt:=cnt+1
Type(NTOC(info))
ENDIF
UNTIL(info=-8097)
STATUSPROMPT("")
PAUSESET(EndFieldKey)
PROMPT("You pressed "+cnt+" keystrokes. Press F9 to continue")
PAUSE
STEP
Show Me An Example...
─────────────────────────────────────────────────────────────────
STEP executes a macro one step at a time and is useful for
debugging macros. When STEP is turned on a dialog box offers
debugging options. If you choose Step, the macro will execute
the next command. Choosing List displays a list of all
encountered variables and their contents. From this list you can
choose which variable table to list (Local, Global, or
Persistent). If you choose Run, the macro will begin executing
and STEP will be turned off. Choosing Cancel will cancel STEP
and macro execution.
Syntax: STEP(State)
Parameters: State
Specifies whether STEP is on. Select an
enumerated type or its numeric equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
Off! 0 Turns STEP off
On! 1 Turns STEP on
═════════════════════════════════════════════════
──── ────For Example...
This macro demonstrates how the STEP command works. The STEP
command is mainly used for debugging purposes.
FORNEXT(Count;1;5)
TYPE("This is line "+Count+".")
HRt
ENDFOR
STEP(On!)
FORNEXT(Count;1;5)
TYPE("This is line "+Count+".")
HRt
ENDFOR
STRLEN
Show Me An Example...
─────────────────────────────────────────────────────────────────
STRLEN returns the number of characters (length), of a character
expression. This command is used in conjunction with commands
that can evaluate its contents or perform an action such as IF,
ASSIGN, or Type.
Syntax: STRLEN("String")
Parameters: String
A character expression or a variable containing a
character expression to evaluate.
See Also: ASSIGN
IF
NUMSTR
STRNUM
STRPOS
STRUNIT
Type
──── ────For Example...
This macro parses an array and displays the student name and
grade.
student[1]:="Mark B. PE 132 A"
student[2]:="Kerry R. Physics 305 B"
student[3]:="Ralph D. CS 351 A"
student[4]:="John B. Math 402 B"
FORNEXT(x;1;4;1)
len:=STRLEN(student[x])
namepos:=STRPOS(student[x];" ")
IF((len=0) OR (namepos=0))
NEXT
name:="xxx"
ENDIF
name:=SUBSTR(student[x];1;namepos-1)
grade:=SUBSTR(student[x];len;1)
Type(name)
FORNEXT(space;1;15-namepos;1)
Type(" ")
ENDFOR
Type(grade)
HRt
ENDFOR
STRNUM
Show Me An Example...
─────────────────────────────────────────────────────────────────
STRNUM converts a character expression to a numeric expression.
This command must be used in an expression and must be used in
conjunction with commands that evaluate expressions, such as IF,
ASSIGN or Type.
Syntax: STRNUM("String")
Parameters: String
A character expression specifying the text to
convert.
See Also: ASSIGN
NUMSTR
STRLEN
STRPOS
STRUNIT
Type
──── ────For Example...
This macro takes the string 15 and displays it as a Number, Unit
and Unit String value.
Num:="15"
ASSIGN(Number;STRNUM(Num))
ASSIGN(Unit;STRUNIT(Num))
ASSIGN(UnitString;UNITSTR(Unit;Centimeters!))
TYPE("The Number value is "+ Number)
HRt
TYPE("The Unit value is "+ Unit)
HRt
TYPE("The Unit String value is "+ UnitString)
HRt
STRPOS
Show Me An Example...
─────────────────────────────────────────────────────────────────
STRPOS returns the position of a substring within an original
string. For example, "Perfect" is a substring of "WordPerfect"
and begins at the fifth character, or position. In this example,
STRPOS returns a value of 5. This command is used in conjunction
with commands that can evaluate its contents or perform an action
such as ASSIGN, IF, or Type. If a substring is not found, STRPOS
returns the value of 0.
Syntax: STRPOS("Original String";"Substring")
Parameters: Original String
A character expression specifying the original
string.
Substring
A character expression specifying the substring.
See Also: ASSIGN
IF
NUMSTR
STRLEN
STRNUM
STRUNIT
SUBSTR
Type
──── ────For Example...
This macro parses an array and displays the student name and
grade.
student[1]:="Mark B. PE 132 A"
student[2]:="Kerry R. Physics 305 B"
student[3]:="Ralph D. CS 351 A"
student[4]:="John B. Math 402 B"
FORNEXT(x;1;4;1)
len:=STRLEN(student[x])
namepos:=STRPOS(student[x];" ")
IF((len=0) OR (namepos=0))
NEXT
name:="xxx"
ENDIF
name:=SUBSTR(student[x];1;namepos-1)
grade:=SUBSTR(student[x];len;1)
Type(name)
FORNEXT(space;1;15-namepos;1)
Type(" ")
ENDFOR
Type(grade)
HRt
ENDFOR
STRUNIT
Show Me An Example...
─────────────────────────────────────────────────────────────────
STRUNIT converts a character expression to a measurement
expression. This command is used in conjunction with such
commands as ASSIGN or Type.
Syntax: STRUNIT("String")
Parameters: String
A character expression specifying the text to
convert.
See Also: ASSIGN
NUMSTR
STRLEN
STRNUM
STRPOS
Type
──── ────For Example...
This macro takes the string 15 and displays it as a Number, Unit
and Unit String value.
Num:="15"
ASSIGN(Number;STRNUM(Num))
ASSIGN(Unit;STRUNIT(Num))
ASSIGN(UnitString;UNITSTR(Unit;Centimeters!))
TYPE("The Number value is "+ Number)
HRt
TYPE("The Unit value is "+ Unit)
HRt
TYPE("The Unit String value is "+ UnitString)
HRt
SUBSTR
Show Me An Example...
─────────────────────────────────────────────────────────────────
SUBSTR creates a substring from an existing string. For example,
to create substring "Brad" from "Bradford", the command is
SUBSTR("Bradford";1;4). The value 1 specifies beginning the
substring at the first character or position of the original
string. The value 4 represents extracting four consecutive
characters, including the character at the beginning position, to
create the substring.
SUBSTR is used in conjunction with commands that can evaluate its
contents or perform an action such as ASSIGN, IF, and Type.
Syntax: SUBSTR("Original String";Beginning Position;Number
of Characters)
Parameters: Original String
A character expression specifying the string from
which to create a substring.
Beginning Position
A numeric expression specifying the number of
characters from the left (or at what position) to
begin the substring. This parameter will also
accept negative numbers to specify a position
beginning at the right.
Number of Characters
A numeric expression specifying the number
characters (including the beginning position) to
extract as the substring.
See Also: ASSIGN
IF
NUMSTR
STRLEN
STRPOS
SUBSTR
STRUNIT
Type
──── ────For Example...
This macro parses an array and displays the student name and
grade.
student[1]:="Mark B. PE 132 A"
student[2]:="Kerry R. Physics 305 B"
student[3]:="Ralph D. CS 351 A"
student[4]:="John B. Math 402 B"
FORNEXT(x;1;4;1)
len:=STRLEN(student[x])
namepos:=STRPOS(student[x];" ")
IF((len=0) OR (namepos=0))
NEXT
name:="xxx"
ENDIF
name:=SUBSTR(student[x];1;namepos-1)
grade:=SUBSTR(student[x];len;1)
Type(name)
FORNEXT(space;1;15-namepos;1)
Type(" ")
ENDFOR
Type(grade)
HRt
ENDFOR
SWITCH
Show Me An Example...
─────────────────────────────────────────────────────────────────
SWITCH is the opening command for a conditional switch statement.
A complete switch statement includes the following commands:
SWITCH, CASEOF, CONTINUE (optional), DEFAULT (optional), and
ENDSWITCH. A switch statement compares a single SWITCH
expression against individual CASEOF expressions and executes
specific commands depending on which CASEOF matches the SWITCH
expression.
The SWITCH command contains an expression to evaluate. Any
expression is valid, but it is usually a variable. In most
cases, the contents of this variable are assigned earlier in the
macro with commands such as CHAR or GETSTRING. This SWITCH
expression is the "test" against which each individual case is
compared. The individual cases are created with the CASEOF
command. When an individual CASEOF expression matches the SWITCH
expression, the macro executes whatever commands follow the
CASEOF that provided the match.
Both the SWITCH and the CASEOF expressions are case sensitive
(capitalization) and must match exactly. If none of the CASEOF
expressions match the SWITCH expression, the macro executes the
commands between DEFAULT and ENDSWITCH. If a DEFAULT command is
not included, the macro is redirected to the commands following
ENDSWITCH.
For example,
LABEL(Question)
CHAR(YESNO;"Do you have a preference? Y/N")
SWITCH(NTOC(YESNO))
CASEOF "Y";"y": Type("Yes")
CASEOF "N";"n": Type("No")
DEFAULT: GO(Question)
ENDSWITCH
In this example, the CHAR command asks the user a question. The
user's response is stored in the variable YESNO. The switch
statement that follows then evaluates that variable and executes
appropriate commands depending on the contents of the variable.
Specifically, if the variable contains either an uppercase or a
lowercase "y," the macro types the word "Yes." If the variable
YESNO contains either an uppercase or lowercase "n," the macro
will type the word "No." If the variable contains anything else,
the macro returns to label Question and the user will have a
chance to respond again.
The CHAR command only recognizes numbers. If a character is
pressed in response to the CHAR command prompt, the character is
converted to its numeric equivalent. The NTOC command in the
switch expression converts the number back to its original
character. For a list of characters and their numeric
equivalents see Appendix A in the Appendices section.
Syntax: SWITCH(Expression)
Parameters: Expression
Specifies the expression to evaluate. All
expressions are valid for this parameter.
See Also: CASEOF
CHAR
CONTINUE
DEFAULT
ENDSWITCH
GETSTRING
LABEL
NTOC
──── ────For Example...
This macro constantly prompts for a name until Cancel is pressed.
ONCANCEL CALL(Cancel)
LABEL(Top)
Name:=""
GETSTRING(Name;"Type in a name, (Cancel or Enter) to
quit";"Name")
IF(Name="")
ASSERT(CancelCondition!)
ENDIF
TYPE(Name)
Hrt
GO(Top)
LABEL(Cancel)
CANCEL(Off!)
CHAR(Selection;"Do you really want to Quit? Y/N")
SWITCH(TOLOWER(NTOC(Selection)))
CASEOF "y" : QUIT
CASEOF "n" : CANCEL(On!) RETURN
DEFAULT : GO(Cancel)
ENDSWITCH
TOLOWER
Show Me An Example...
─────────────────────────────────────────────────────────────────
TOLOWER converts a character expression to lowercase letters.
This command is used in conjunction with commands that can
evaluate its contents or perform an action such as ASSIGN, IF,
and Type.
Syntax: TOLOWER("String")
Parameters: String
A character expression specifying the text to
convert.
See Also: ASSIGN
IF
TOUPPER
Type
──── ────For Example...
This macro executes a function from within a TYPE command.
Prmt:="Would you like to continue?"
Type ("You pressed "+YesNo(prmt))
//More code for the macro
Quit
FUNCTION YesNo (message)
LOCAL(ans)
IF (EXISTS(ans))
DISCARD(ans)
ENDIF
LABEL(Begin)
CHAR(ans;message+" Y/N")
SWITCH(TOLOWER(NTOC(ans)))
CASEOF "y" : ans:="Y"
CASEOF "n" : ans:="N"
DEFAULT : GO(Begin)
ENDSWITCH
RETURN(ans)
ENDFUNC
TOUPPER
Show Me An Example...
─────────────────────────────────────────────────────────────────
TOUPPER converts a character expression to uppercase letters.
This command is used in conjunction with commands that can
evaluate its contents or perform an action such as ASSIGN, IF,
and Type.
Syntax: TOUPPER("String")
Parameters: String
A character expression specifying the text to
convert.
See Also: ASSIGN
IF
TOLOWER
Type
──── ────For Example...
This macro creates a secondary merge file through a series of
prompts.
ASSIGN(More;"Y")
WHILE(TOUPPER(More)="Y")
FOREACH(field;{"First Name";"Last
Name";"Company";"Address";"City";"State";"Zip"})
GETSTRING(info;"Enter the "+field;"Field "+field;)
TYPE(info)
EndField
info:=""
ENDFOR
MergeCode(EndRecord!)
CHAR(More;"Enter another record? Y/N")
ASSIGN(More;NTOC(More))
ENDWHILE
UNITSTR
Show Me An Example...
─────────────────────────────────────────────────────────────────
UNITSTR converts a measurement expression to a character
expression.
Syntax: UNITSTR(Measurement;Unit of Measurement)
Parameters: Measurement
A measurement expression specifying the number to
convert or a variable containing a measurement
expression.
Unit of Measurement
Specifies the unit of measurement. Select an
enumerated type or its numeric equivalent
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
Inches! 0 Converts inches (")
InchesI! 1 Converts inches (i)
Centimeters! 2 Converts centimeters
Millimeters! 3 Converts millimeters
Points! 4 Converts points
WP1200ths! 5 Converts 1200ths of an
inch
WP42Units! 6 Converts WP 4.2 units
═════════════════════════════════════════════════
──── ────For Example...
This macro takes the string 15 and displays it as a Number, Unit
and Unit String value.
Num:="15"
ASSIGN(Number;STRNUM(Num))
ASSIGN(Unit;STRUNIT(Num))
ASSIGN(UnitString;UNITSTR(Unit;Centimeters!))
TYPE("The Number value is "+ Number)
HRt
TYPE("The Unit value is "+ Unit)
HRt
TYPE("The Unit String value is "+ UnitString)
HRt
UNTIL
Show Me An Example...
─────────────────────────────────────────────────────────────────
UNTIL is the closing command of a REPEAT-UNTIL loop. The loop
continues until the expression in the UNTIL command is true. For
example, a macro that counts to ten could use the following
REPEAT-UNTIL loop:
ASSIGN(Count;1)
REPEAT
ASSIGN(Count;Count + 1)
UNTIL(Count=10)
This example adds 1 to the value of variable Count each time the
loop repeats. When Count equals 10, the UNTIL expression is
satisfied and the loop ends. The macro then resumes with the
command immediately following UNTIL. UNTIL expressions are
evaluated at the end of the loop. As a result, a REPEAT-UNTIL
loop always executes at least once, regardless of whether the
condition is true or false. For information on conditional loops
that evaluate expressions at the beginning, and will not execute
if the expression is false, see WHILE and ENDWHILE.
Syntax: UNTIL(Test)
Parameters: Test
A relational expression to evaluate.
See Also: ENDWHILE
REPEAT
WHILE
──── ────For Example...
This macro counts keystrokes until the user presses Ctrl-Enter.
STATUSPROMPT("Press Ctrl+Enter to quit")
cnt:=0
REPEAT
LOOK(info)
IF((info<>0) AND (info<>-8097))
cnt:=cnt+1
Type(NTOC(info))
ENDIF
UNTIL(info=-8097)
STATUSPROMPT("")
PAUSESET(EndFieldKey)
PROMPT("You pressed "+cnt+" keystrokes. Press F9 to continue")
PAUSE
USE
Show Me An Example...
─────────────────────────────────────────────────────────────────
USE enables macros to share FUNCTIONs and PROCEDUREs. This
command specifies a macro containing a FUNCTIONs and/or
PROCEDUREs that can be used in the current macro. USE can
specify a macro file library (a macro that does not execute, but
simply contains FUNCTIONs and/or PROCEDUREs), or another
executable macro.
Syntax: USE("Macro")
Parameters: Macro
A character expression specifying the macro or
macro file library to use.
See Also: FUNCTION
PROCEDURE
──── ────For Example...
This macro uses the function FileExists from the macro
Library.wpm.
DISPLAY(Off!)
USE("Library.wpm")
LABEL(Begin)
GetString(flname;"Enter the name of the file")
rslt:=FileExists("";flname+".doc") //FileExists is a function in
//Library.wpm It returns a
IF(rslt) //boolean (true/false) value.
CHAR(ans;"This file already exists. Overwrite it? y/n")
SWITCH(NTOC(ans))
CASEOF "Y";"y" : GO(Save)
CASEOF "N";"n" : CONTINUE
DEFAULT : GO(Begin)
ENDSWITCH
ENDIF
LABEL(Save)
FileSave(flname+".doc")
USERFUNCTION
Show Me An Example...
─────────────────────────────────────────────────────────────────
USERFUNCTION passes executable strings to a third party program.
The string specified depends on the program to which it is being
passed.
Syntax: USERFUNCTION(<Signature>:<Action>)
Parameters: Signature
Specifies a four-character identification for the
third party program.
Action
Specifies a character string that the third party
program can execute.
──── ────For Example...
This command is specific to third-party products such as TSR's.
Therefore, no example is supplied since this command will be
specific to each individual user.
VARERRCHK
Show Me An Example...
─────────────────────────────────────────────────────────────────
VARERRCHK determines whether undefined variables cause an error
message. By default, undefined variables will generate the error
"Variable not Assigned a Value" and stops the macro from
executing further. Undefined variables can occur in commands,
such as Type, that use variables to perform an action. For
example, the command Type(Number) could generate an error if
variable Number is not assigned earlier in the macro. The same
error is generated if the Type command is meant to type the word
"Number", but the quotes defining it as a character expression
are not included. With VARERRCHK(Off!), a macro will continue
running even if it contains undefined variables.
Syntax: VARERRCHK(State)
Parameters: State
Specifies whether variable error checking is on.
Select an enumerated type or its numeric
equivalent.
Enumerated Numeric Description
Type Equivalent
═════════════════════════════════════════════════
Off! 0 Error checking off
On! 1 Error checking on
═════════════════════════════════════════════════
See Also:
──── ────For Example...
This macro assigns a name to the variable Name if the variable
doesn't exist.
VARERRCHK(Off!)
IF (Name="")
GETSTRING(Name;"Enter your name";"Name")
TYPE(Name)
ELSE
TYPE(Name)
ENDIF
WAIT
Show Me An Example...
─────────────────────────────────────────────────────────────────
WAIT suspends macro execution for a specified amount of time.
This is useful, for example, to display a prompt on the screen
for a certain amount of time. If a user begins typing while the
macro is suspended, the keystrokes are ignored until the
specified time has elapsed. The length of WAIT is specified in
tenths of a second, with a maximum of one minute, or WAIT(600).
Syntax: WAIT(Tenths of a Second)
Parameters: Tenths of a Second
A numeric expression specifying the amount of time
to wait.
See Also: PAUSE
PROMPT
STATUSPROMPT
──── ────For Example...
This macro prompts the user for a return address and assigns it
to a series of variables. It then makes the variables accessible
until WordPerfect is exited.
DLGCREATE(x;"Return Address";DLGNoCancel!;;;50;10)
DLGCONTROL(CtrlText!;name;"Name";StyInitial!;1;3;37;2)
DLGCONTROL(CtrlText!;address;"Street Address";;1;5;27;2)
DLGCONTROL(CtrlText!;c;"City, State ZIP ";;1;7;25;2)
DLGEND
PERSISTALL
Prompt("All the variables are now accessible in any
macro/merge.")
WAIT(50)
WHILE
Show Me An Example...
─────────────────────────────────────────────────────────────────
WHILE is the opening command of a WHILE-ENDWHILE loop. This loop
repeatedly executes the commands between WHILE and ENDWHILE as
long as the WHILE expression is true. The expression is
evaluated at the top of the loop. If the expression is false,
macro execution resumes with the command immediately following
ENDWHILE. For information on loops that evaluate expressions at
the end of the loop, see REPEAT and UNTIL.
Syntax: WHILE(Test)
Parameters: Test
A relational expression to evaluate.
See Also: ENDWHILE
REPEAT
UNTIL
──── ────For Example...
This macro creates a secondary merge file through a series of
prompts.
ASSIGN(More;"Y")
WHILE(TOUPPER(More)="Y")
FOREACH(field;{"First Name";"Last
Name";"Company";"Address";"City";"State";"Zip"})
GETSTRING(info;"Enter the "+field;"Field "+field;)
TYPE(info)
EndField
info:=""
ENDFOR
MergeCode(EndRecord!)
CHAR(More;"Enter another record? Y/N")
ASSIGN(More;NTOC(More))
ENDWHILE
XOR
Show Me An Example...
─────────────────────────────────────────────────────────────────
XOR is an operator that evaluates at least two expressions in a
conditional statement. Conditional statements are created with
commands such as IF, REPEAT, and WHILE. This operator performs a
logical exclusive OR and evaluates a conditional statement as
true if one expression is true, but not if more than one
expression is true.
Parameters: None
See Also: AND
IF
NOT
OR
REPEAT
WHILE
──── ────For Example...
This macro sends an appropriate letter to one or both employees.
CHAR(Emp1;"Did employee number one finish the assigned task?
Y/N")
CHAR(Emp2;"Did employee number two finish the assigned task?
Y/N")
IF((TOUPPER(Emp1)="Y") XOR (TOUPPER(Emp2)="Y"))
SWITCH ("Y")
CASEOF TOUPPER(Emp1) : CALL(Emp1)
CASEOF TOUPPER(Emp2) : CALL(Emp2)
ENDSWITCH
ELSE
IF(TOUPPER(Emp1)="Y")
emp:="Both"
Letter:="Congrats"
ELSE
emp:="Neither"
Letter:="ChewOut"
ENDIF
ENDIF
PERSIST(emp)
CHAIN(Letter)
LABEL(Emp1)
emp:="Paul"
Letter:="ChewOut"
RETURN
LABEL(Emp2)
emp:="George"
Letter:="ChewOut"
RETURN