Click the Help Topics button to return to the list of topics.
PerfectScript Macro Commands List
~
**
*
/
%
+
+
-
-
<<
>>
<<<
>>>
=
<>
!=
<
<=
>
>=
&
&
|
^
:=
=
;
.
..
..
[ ]
[0]
{ }
{ }
( )
( )
' '
" "
"
!
@
:
:
b
o
x
h
w
c
m
i
p
//
/* */
A
AbsVal
acos
acosh
Address
Amortize
AND
Animate
AnsiString
AppActivate
AppClose
AppExecute
Application
AppLocate
AppShow
asin
asinh
Assert
atan
atan2
atanh
Average
B
Beep
BinaryPack
BinaryUnPack
Break
C
Call
Call
Callback Data Description
CallbackResume
CallbackWait
Cancel
Case
Case Call
CaseOf:
Ceiling
Chain
CharLen
CharPos
CheckSum
CloseFile
Condition
Constant
Constants
Continue
ConvertType
CopyFile
cos
cosh
CreateDirectory
CreateObject
CToN
CubeRoot
D
DateAddDays
DateAddMonths
DateAddWeeks
DateAddYears
DateAndTime
DateDay
DateDayOfYear
DateDaysInMonth
DateDaysInYear
DateIsLeapYear
DateMonth
DateMonthName
DateOfMonthEnd
DateOfNthDay
DateOfNthWeek
DateOfNthWeekday
DatePart
DateString
DateWeekday
DateWeekdayName
DateWeekOfYear
DateYear
DDEExecute
DDEInitiate
DDEPoke
DDERequest
DDETerminate
DDETerminateAll
Declare
Default:
DefaultUnits
DegreesToRadians
DeleteDirectory
DeleteFile
DialogAddBitmap
DialogAddCheckBox
DialogAddColorWheel
DialogAddComboBox
DialogAddControl
DialogAddCounter
DialogAddDate
DialogAddEditBox
DialogAddFileNameBox
DialogAddFrame
DialogAddGroupBox
DialogAddHLine
DialogAddHotSpot
DialogAddIcon
DialogAddListBox
DialogAddListItem
DialogAddProgress
DialogAddPushButton
DialogAddRadioButton
DialogAddScrollBar
DialogAddText
DialogAddViewer
DialogAddVLine
DialogControlQuery
DialogControlUpdate
DialogDefine
DialogDelete
DialogDestroy
DialogDismiss
DialogHandle
DialogLoad
DialogSave
DialogSetProperties
DialogShow
Dimensions
Discard
DIV
DLLCall
DLLCall Prototype
DLLFree
DLLLoad
DoesDialogExist
DoesDirectoryExist
DoesFileExist
DoesRegionExist
DWord
E
Else
ElseIfPlatform
EndApp
EndFor
EndFunc
EndFunction
EndIf
EndIfPlatform
EndProc
EndProcedure
EndPrompt
EndSwitch
EndWhile
EndWith
EnvVariableGet
EnvVariableSet
Error
ErrorNumber
Exists
ExitHandlerState
ExponentPart
F
Factorial
False
Fibonacci
FileCheckSum
FileConvert
FileConvertError
FileError
FileFind
FileFlushData
FileGetLongName
FileGetShortName
FileIsEOF
FileNameDialog
FilePosition
FileRead
FileSize
FileTruncate
FileType
FileTypeExtension
FileTypeList
FileTypeName
FileWrite
FileWriteLine
Floor
For
ForEach
ForNext
Fraction
FractionalPart
FractionStr
Function Prototype
Function
G
gcf
GetCurrentDirectory
GetFileAttributes
GetFileDateAndTime
GetNumber
GetObject
GetString
GetUnits
Global
Go
GoOnline
H
No commands
I
If
IfPlatform
IN
Include
Indirect
Integer
IntegerPart
J
No commands
K
No commands
L
Label
lcm
lg
LIKE
ln
Local
log
logn
M
MacroArgs[ ]
MacroCompile
MacroDialogResult
MacroInfo
MacroIsCompiled
MacroPlay
MantissaPart
Max
MaxN
MeanDev
Median
Menu
MessageBox
Min
MinN
MMPlay
MMSpeak
MMSpeakClipboard
MMStopPlay
MMStopSpeech
MOD
N
Nest
NetAddConnection
NetCancelConnection
NetConnectionDlg
NetDisconnectDlg
NetGetConnection
NetGetUniversalName
NetGetUser
NewDefault
Next
NOT
NotFound
NthRoot
NToC
NToC
NumStr
O
Object
ObjectInfo
OemString
OLE Automation
OnCancel
OnCancel Call
OnCondition Call
OnCondition
OnDDEAdvise Call
OnError Call
OnError
OnExit
OnNotFound
OnNotFound Call
OnVarErrChk
OnVarErrChk Call
OpenFile
OR
P
Pause
PercentChange
PercentOf
PercentOfTotal
Persist
PersistAll
pi
PrimeFactors
Procedure
Procedure Prototype
Product
Prompt
Q
Quit
R
RadiansToDegrees
Randomize
RandomNumber
RandomSeed
RandomStats
Real
RegionAddListItem
RegionAddListItemByIndex
RegionEnableWindow
RegionGetCheck
RegionGetChildCount
RegionGetClass
RegionGetFocus
RegionGetHandle
RegionGetID
RegionGetListContents
RegionGetListCount
RegionGetListItem
RegionGetListItemByIndex
RegionGetListSelectedCount
RegionGetModified
RegionGetName
RegionGetOrder
RegionGetPosition
RegionGetSelectedText
RegionGetStyle
RegionGetType
RegionGetVariable
RegionGetWindowText
RegionIsEnabled
RegionIsVisible
RegionMoveWindow
RegionRemoveListItem
RegionRemoveListItemByIndex
RegionResetList
RegionSelectListItemByIndex
RegionSelectListItem
RegionSetBitmap
RegionSetCheck
RegionSetEditSelection
RegionSetFocus
RegionSetModified
RegionSetProgressPercent
RegionSetSelectedText
RegionSetTabStops
RegionSetWindowText
RegionShowWindow
RegistryCloseKey
RegistryCreateKey
RegistryDeleteKey
RegistryDeleteValue
RegistryEnumKey
RegistryEnumValue
RegistryOpenKey
RegistryQueryKeyCount
RegistryQueryLastError
RegistryQueryValue
RegistryQueryValueCount
RegistrySetValue
RenameDirectory
RenameFile
Repeat
Return
Return
RoundOff
Run
S
SendKeys
SetCurrentDirectory
SetDefaultParent
SetFileAttributes
SetFileDateAndTime
Sign
sin
sinh
SizeOf
Speed
SquareRoot
Step
StdDev
StrFill
StrFraction
String
StrInsert
StrIsChar
StrLeft
StrLen
StrMakeList
StrNum
StrPad
StrParseList
StrPos
StrReverse
StrRight
StrScan
StrToChars
StrTransform
StrTrim
Structure
StrUnit
SubChar
SubStr
Sum
Switch
T
tan
tanh
TimeHour
TimeHundredth
TimeMinute
TimePart
TimeSecond
TimeString
TimeZoneInfo
ToInitialCaps
ToLower
ToUpper
True
U
UnitStr
Until
Use
V
Value
ValueType
VarErrChk
Variance
VersionInfo
W
Wait
While
With
WordCount
WPString
X
XOR
Y
No commands
Z
No commands
Dialog Box Controls
Input or output windows where the user interacts with a dialog box and its parent application. Macros support the following dialog box controls:
Bitmaps
Check Boxes
Color Wheels
Combination Boxes
Counter Buttons
Dates
Edit Boxes
Filename Edit Boxes
Frames
Group Boxes
Horizontal Lines
Hot Spots
Icons
List Boxes
Progress Indicators
Push Buttons
Radio Buttons
Scroll Bars
Static Text Controls
Viewers
Vertical Lines
Check Boxes
Display one or more options. Use a callback function to activate user-defined responses. See DialogAddCheckBox.
Color Wheels
Display colors to select. See DialogAddColorWheel.
Combination Boxes
Display an edit box and a list box. Enter text such as a filename in the edit box, or double-click a list item to insert it. See DialogAddComboBox.
Counter Buttons
Display an edit box and a counter button. Enter a number in the edit box, or click the counter button to insert a number. See DialogAddCounter.
Edit Boxes
Receive text input. There are different styles of edit controls, including single line and multiple line. See DialogAddEditBox.
Filename Edit Boxes
Display an edit control and a button control. Enter a filename in the edit control, or click the button to display the Select File dialog box. See DialogAddFileNameBox.
Frames
Group items in a dialog box. Accept no input. See DialogAddFrame.
Group Boxes
Group items in a dialog box with a titled frame. Accept no input. See DialogAddGroupBox.
Horizontal Lines
Separate items in a dialog box. Accept no input. See DialogAddHLine.
Hot Spots
Invisible controls that close a dialog box when the user clicks a defined area. Redefine the response with a callback function. See DialogAddHotSpot.
Icons
Display graphics representations. Accept no input, unless used in a callback function with DialogAddHotspot. See DialogAddHotSpot, DialogAddIcon, DialogShow.
List Boxes
Display a list of options to choose from. There are different styles of list boxes, including single column and multi column. See DialogAddListBox.
Pop-Up Buttons
Display the name of a menu item on a push button. Click the button to display the menu.
Push Buttons
Activate user-defined responses when chosen. See DialogAddPushButton.
Radio Buttons
Display mutually exclusive options. Use a callback function to activate user-defined responses. See DialogAddRadioButton and DialogShow.
Scroll Bars
Scroll through documents, or activate user-defined responses with a callback function. See DialogAddScrollBar and DialogShow.
Static Text Controls
Send text to a dialog box. Accept no input. See DialogAddText.
Viewers
Display read-only text files. See DialogAddViewer.
Vertical Lines
Separate items in a dialog box. Accept no input. See DialogAddVLine.
Macro: ASSERT.WCM
ASSERT.WCM uses MENU to display a list of options; ASSERT to create a Cancel, Error, or Not Found condition; and ONCANCEL, ONERROR, or ONNOTFOUND to execute a subroutine. It also uses MESSAGEBOX to display messages and Go to create user-defined loops. Click the comment buttons for detailed explanations.
MESSAGEBOX(vStatus; "Condition Status"; vMessage; Ok! | IconInformation! | HasParameters!; {"You selected 1 with CANCEL(On!)"; "You selected 2 with ERROR(On!)"; "You selected 3 with NOTFOUND(On!)"; "Menu item not chosen"}) // 50
GO(DisplayMenu) // 51
LABEL(TurnConditionsOn) // 52
CANCEL(On!) // 53
ERROR(On!) // 54
NOTFOUND(On!) // 55
vCondition := "Turn conditions Off!" // 56
GO(DisplayMenu) // 57
LABEL(TurnConditionsOff) // 58
CANCEL(Off!) // 59
ERROR(Off!) // 60
NOTFOUND(Off!) // 61
vCondition := "Turn conditions On!" // 62
GO(DisplayMenu) // 63
Lines 1-3
Comments about the macro.
Line 2
Macros are generally saved to the application's macros directory.
Line 4
WordPerfect identified as the default application.
Line 5
Call LABEL(AssertConditions), which identifies a LABEL subroutine to call when there is a Cancel, Error, or Not Found condition (lines 12-14).
Line 6
Call LABEL(DisplayMenu) after LABEL(AssertConditions) returns (line 16). LABEL(DisplayMenu) displays a five-option menu (line 18).
Line 7
Call LABEL(QuitMacro) after LABEL(DisplayMenu) returns (line 31). LABEL(QuitMacro) displays a message box where the user can end the macro or redisplay the menu (lines 32-39).
Lines 8-10
Comments identify LABELs that correspond to the opening CALL statements (lines 5-7).
Lines 11-16
LABEL(AssertConditions) identifies a LABEL to execute when a Cancel, Error, or Not Found condition occurs.
Line 12
Execute LABEL(Conditions) when a Cancel condition occurs (line 43).
Line 13
Execute LABEL(Conditions) when an Error condition occurs (line 43).
Line 14
Execute LABEL(Conditions) when a Not Found condition occurs (line 43).
Line 15
Assignment operator assigns a character string to a variable named vCondition, which is menu item 4 the first time the menu is displayed (line 18). The default condition for CANCEL, ERROR, and NOTFOUND is On!.
Line 16
RETURN statement directs macro execution to CALL(DisplayMenu) (line 6).
Lines 17-31
LABEL displays a five-option menu and asserts a Cancel, Error, or Not Found condition depending on a menu choice.
Line 18
MENU displays a numbered (Digit!) list of five items. The number the user chooses is assigned to vChoice. Omitting the third and fourth parameters centers the menu on the screen.
Line 19
SWITCH initiates an action, depending on the value of vChoice, which contains the number of the chosen menu item.
Line 20
If 1 is selected, assert a Cancel condition. The macro assigns 1 to the variable ErrorNumber (see Assert). LABEL(Condition) is automatically called (lines 12 and 45).
Line 21
If 2 is selected, assert an Error condition. The macro assigns 2 to the variable ErrorNumber (see Assert). LABEL(Condition) is automatically called (lines 13 and 46).
Line 22
If 3 is selected, assert a Not Found condition. The macro assigns 7 to the variable ErrorNumber (see Assert). LABEL(NotFound) is automatically called (line 14 and line 47).
Lines 23-27
If 4 is selected, toggle CANCEL, ERROR, and NOTFOUND conditions by calling LABEL(TurnConditionsOn) (lines 52-57) or LABEL(TurnConditionsOff) (lines 58-63). The label called depends on the contents of variable vCondition (lines 15, 56, and 62). Update the description of menu item 4.
Line 28
If 5 is selected, end (quit) macro.
Line 29
If another key is pressed, such as Esc, LABEL(Condition) executes. Notice that the subroutine name executes the subroutine.
Line 30
ENDSWITCH closes SWITCH statement (line 19).
Line 31
RETURN statement directs macro execution to CALL(QuitMacro).
Lines 32-39
LABEL(QuitMacro) displays a message box with an option to end the macro or redisplay the menu.
Line 33
Assignment operator assigns character string "You selected 5, or you selected 1, 2, or 3 with all conditions Off!" to variable vMessage (line 34).
Line 34
MESSAGEBOX displays a message box with an information icon and Retry and Cancel buttons. If Retry is chosen, 4 is assigned to variable vStatus, or 2 is assigned to vStatus if Cancel is chosen.
Lines 35-36
If variable vStatus equals 4 (line 34), GO sends macro execution to LABEL(DisplayMenu), which redisplays the menu.
Lines 37-38
If vStatus is any value except 4 (Else), end the macro (QUIT).
Line 39
ENDIF closes IF statement (line 35).
Lines 40-42
Comments identify secondary LABELs or LABELs called from another LABEL (see lines 12-14, 24, and 26).
Lines 43-51
Execute LABEL(Conditions) when the user chooses 1, 2, or 3 (lines 20-22 and 12-14).
Line 44
SWITCH initiates an action, depending on the value of the variable ErrorNumber (lines 20, 21, 22) (see Assert).
Line 45
If ErrorNumber equals 1 (Cancel condition), assign "^1" to vMessage (see line 50).
Line 46
If ErrorNumber equals 2 (Error condition), assign "^2" to vMessage (see line 50).
Line 47
If ErrorNumber equals 7 (NotFound condition), assign "^3" to vMessage (line 50).
Line 48
If ErrorNumber contains a value other than 1, 2, or 7, assign "^4" to vMessage (line 50).
Line 49
ENDSWITCH closes SWITCH statement (line 44).
Line 50
MESSAGEBOX displays a message box with an information icon and OK button. It uses the HasParameters! style, followed by four Message parameter options. A caret (^) followed by a number in the Message parameter inserts the corresponding ParameterData message (one of the four message options) in its place (lines 45-48). Numbering begins with 0. See MessageBox.
Line 51
GO creates a loop by sending macro execution to LABEL(DisplayMenu), which redisplays the menu.
Lines 52-55
LABEL(TurnConditionsOn) turns on CANCEL, ERROR, and NOTFOUND conditions after LABEL(TurnConditionsOff) is executed.
Line 56
Assigns character string "Turn conditions Off!" to variable vCondition, which is displayed as menu item 4 (line 18).
Line 57
GO creates a loop by sending macro execution to LABEL(DisplayMenu), which redisplays the menu.
Lines 58-61
LABEL(TurnConditionsOff) turns off CANCEL, ERROR, and NOTFOUND conditions after the macro first starts or LABEL(TurnConditionsOn) is executed.
Line 62
Assigns character string "Turn conditions On!" to variable vCondition, which is displayed as menu item 4 (line 18).
Line 63
GO statement creates a loop by sending macro execution to LABEL(DisplayMenu), which redisplays the menu.
Macro: CALLBACK.WCM
CALLBACK.WCM creates a callback function that responds to system menu box options, check boxes, radio buttons, QuickSpots, and push buttons. Click the comment buttons for detailed explanations.
// Name: CALLBACK.WCM // 1
// Directory: C:\OFFICE7\MACROS\... // 2
// Description: Callback function displays a message when a user chooses a dialog box control // 3
MESSAGEBOX(vStatus; "Check Box"; "Check boxes display options. Choose OK to hide the message box and return to the main dialog box."; OK! | IconInformation!) // 53
DIALOGSHOW (1000;1; MsgLoop) // 54
CASEOF 102: // 55
MESSAGEBOX(vStatus; "Radio Button"; "Radio buttons display mutually-exclusive options. Choose OK to hide the message box and return to the main dialog box."; OK! | IconInformation!) // 56
CASEOF 103: // 57
MESSAGEBOX(vStatus; "QuickSpot"; "A QuickSpot was created over a filled frame. You can also create a QuickSpot over an icon. Choose OK to hide the message box and return to the main dialog box."; OK! | IconInformation!) // 58
CASEOF "OKBttn": // 59
MESSAGEBOX(vStatus; "OK Button"; "You clicked the OK button on the main dialog box. Click OK to hide the message box and return to the main dialog box."; OK! | IconInformation!) // 60
CASEOF "CancelBttn": // 61
MESSAGEBOX(vStatus; "Cancel Button"; "Choosing Cancel assigns ""No"" to variable vLoop, which ends the loop and the macro."; OK! | IconExclamation!) // 62
vLoop := "No" // 63
ENDSWITCH // 64
IF(MsgLoop[5] = WM_SYSCOMMAND) // 65
MESSAGEBOX(vStatus; "System Command"; "After you click OK, the main dialog box will disappear and then reappear after one second."; OK! | IconInformation!) // 66
DIALOGDISMISS(1000; "OKBttn") // 67
WAIT(10) // 68
DIALOGSHOW(1000; 1; MsgLoop) // 69
ENDIF // 70
RETURN // 71
Lines 1-3
Comments about the macro.
Line 2
Macros are generally saved to the default macros directory.
Line 4
WordPerfect identified as the default application.
Lines 5-7
Comments identify the opening CALL statements that outline and define the macro's basic operations.
Line 8
Call LABEL(InitializeVariables), which initializes all variables (lines 16-22). A run-time error occurs if you reference a variable that has not been assigned a value. See VarErrChk.
Line 9
Call LABEL(CreateDialog) after LABEL(InitializeVariables) returns. LABEL(CreateDialog) creates a dialog box in memory (lines 23-35). It does not display the dialog box.
Line 10
Call LABEL(DisplayMainDialog) after LABEL(CreateDialog) returns. LABEL(DisplayMainDialog) displays the dialog box and identifies a callback function. See DialogShow.
Line 11
Call LABEL(StartMessageLoop) after LABEL(DisplayDialog) returns. LABEL(StartMessageLoop) starts a message loop that suspends the dialog box for callback functions (lines 49-71).
Line 12
CALL LABEL(QuitMacro) after LABEL(StartMessageLoop) returns. LABEL(QuitMacro) removes the dialog box from memory and ends the macro.
Lines 13-15
Comments identify LABELs that correspond to the opening CALL statements (lines 8-12).
Lines 16-22
LABEL(InitializeVariables) initializes all variables.
Lines 17-18
Initialize variables to contain Windows message numbers. Using variables makes the macro easier to read. The variable names are user defined, but match the Windows message names. See DialogShow.
Lines 19-20
Initialize check box and radio button variables (lines 25, 26).
Line 21
Initialize the loop variable. vLoop is later assigned a new value to end the message loop (line 63), which sends macro execution to CALL(QuitMacro).
Line 22
RETURN sends macro execution to CALL(CreateDialog).
Lines 23-35
LABEL(CreateDialog) creates a dialog box in memory.
Lines 25-27
Control parameter values are sent as messages to the callback function (52-63).
Line 35
RETURN sends macro execution to CALL(DisplayMainDialog).
Lines 36-38
LABEL(DisplayMainDialog) displays the dialog box and identifies the callback function MsgLoop. RETURN sends macro execution to CALL(StartMessageLoop).
Lines 39-42
LABEL(StartMessageLoop) starts the message loop that suspends the dialog box for callback functions (lines 49-71). RETURN sends macro execution to CALL(QuitMacro).
Lines 43-45
LABEL(QuitMacro) removes the dialog box from memory and ends the macro.
Lines 46-48
Comments identify the callback function.
Lines 49-71
Callback function MsgLoop responds to five Control parameter messages and one system command message. See DialogShow.
Line 50
SWITCH tests the third element of the callback function array. See DialogShow.
Lines 51-63
Array element MsgLoop[3] contains the Control parameter value of the control that calls the callback function. A message box describes the control. In this macro, Cancel is the only button that can dismiss the dialog box.
Line 52
DIALOGDISMISS hides the dialog box while the message box is displayed (line 54).
Line 54
DIALOGSHOW redisplays the dialog box after the message box is dismissed (line 52).
Line 64
ENDSWITCH closes the SWITCH statement (line 50).
Lines 65-70
A WM_SYSCOMMAND message is received when the user clicks Close from the system menu box, double-clicks the system menu box, or presses Alt+F4.
Lines 67-69
DIALOGDISMISS hides the dialog box after the message box is dismissed. WAIT(10) pauses the macro for one second. DIALOGSHOW redisplays the dialog box.
Line 70
ENDIF closes the IF statement (line 65).
Line 71
RETURN sends macro execution to the message loop (lines 39-42).
CB_SCBAR.WCM
CB_SCBAR.WCM creates a callback function that responds to Windows WM_VSCROLL, WM_ACTIVATE, and WM_SYSCOMMAND messages. It uses DIALOGADDSCROLLBAR to display a list item. Click the comment buttons for detailed explanations.
// Name: CB_SCBAR.WCM // 1
// Directory: C:\OFFICE7\MACROS\... // 2
// Description: Use DIALOGADDSCROLLBAR and a callback function // 3
MESSAGEBOX(vStatus; "Message Box"; "Do you want to cancel this message?"; YesNo! | IconQuestion!) // 133
IF(vStatus = 6) // 134
WM_ACTIVATE := 0 // 135
ENDIF // 136
RETURN // 137
Lines 1-3
Comments about the macro.
Line 2
Macros are generally saved to the default macros directory.
Line 4
WordPerfect identified as the default application.
Lines 5-7
Comments identify the opening CALL statements which outline and define the macro's basic operations.
Line 8
Call LABEL(InitializeVariables), which initializes all variables (lines 16-38). A run-time error occurs if you reference a variable that has not been assigned a value. See VarErrChk.
Line 9
Call LABEL(CreateDlg) after LABEL(InitializeVariables) returns. LABEL(CreateDlg) creates a dialog box in memory (lines 39-47). It does not display the dialog box.
Line 10
Call LABEL(DisplayDlg) after LABEL(CreateDlg) returns. LABEL(DisplayDlg) displays the dialog box and identifies a callback function. See DialogShow.
Line 11
CALL LABEL(MessageLoop) after LABEL(DisplayDlg) returns. LABEL(MessageLoop) starts a message loop that suspends the dialog box for callback function (lines 61-74).
Line 12
CALL LABEL(QuitMacro) after LABEL(MessageLoop) returns. LABEL(QuitMacro) removes the dialog box from memory and ends the macro.
Lines 13-15
Comments identify LABELs that correspond to the opening CALL statements (lines 8-12).
Lines 16-38
LABEL(InitializeVariables) initializes all variables.
Lines 17-25
Initialize variables with numbers that correspond to positions on the scroll bar. See DialogAddScrollBar.
Line 26
The position of the most recent list item displayed in the dialog box. This position is cleared of text when a new list item is displayed (lines 127-128).
Line 27
The current position for displaying a new list item (line 129).
Lines 28-30
Initialize variables to contain Windows message numbers. Using variables makes the macro easier to read. The variable names are user defined, but match the Windows message names. See DialogShow.
Line 31
Initialize the loop variable. In this example, vLoop does not receive a new value. The loop ends when the macro ends (line 57). It is possible to end the message loop and not the macro by changing the value of vLoop.
Line 32
Creates a 10-element array named List.
Lines 33-37
Fills array with the names of 10 fruits. Variable vElement identifies the element to fill.
Line 38
RETURN sends macro execution to CALL(CreateDlg).
Lines 39-47
LABEL(CreateDlg) creates a dialog box in memory.
Lines 42-44
A FORNEXT statement creates a list of names. The Control parameter of DIALOGADDTEXT is set to 0 to allow this command to execute in a FORNEXT statement. This is possible for controls that do not accept input.
Line 43
List is a 10-element array. The initial value of variable yPos is also 10. Dividing yPos by 10 reduces yPos to a number that corresponds to an element in the array. DIALOGADDTEXT uses the number to display the contents of the corresponding element.
Line 44
ENDFOR closes the FORNEXT statement (line 42).
Line 45
Displays the first list item in a second column.
Line 46
Displays the initial thumb position.
Line 47
RETURN sends macro execution to CALL(DisplayDlg).
Lines 48-50
LABEL(DisplayDlg) displays the dialog box and identifies the callback function MsgLoop. RETURN sends macro execution to CALL(StartMessageLoop).
Lines 51-54
LABEL(StartMessageLoop) starts the message loop that suspends the dialog box for callback functions (lines 61-74). RETURN sends macro execution to CALL(QuitMacro).
Lines 55-57
LABEL(QuitMacro) removes the dialog box from memory and ends the macro.
Lines 58-60
Comments identify the callback function.
Lines 61-74
Callback function MsgLoop responds to three Windows messages and one Control parameter message. See DialogShow.
Line 62
SWITCH tests the fifth element of the callback function array. See DialogShow.
Lines 63-64
A WM_SYSCOMMAND message is received when the user clicks Close from the system menu box, double-clicks the system menu box, or presses Alt+F4. Macro execution jumps to LABEL(QuitMacro).
Lines 65-66
A WM_VSCROLL message is received when the user clicks the scroll bar. The macro calls LABEL(ScrollCtrl).
Lines 67-68
A WM_ACTIVATE message is received when the dialog box is activated. The macro calls LABEL(MsgBox).
Line 69
ENDSWITCH closes the SWITCH statement (line 62).
Lines 70-73
SWITCH tests the third element of the callback function array and determines when Cancel is chosen. See DialogShow. An IF statement also works here. There is often more than one choice to test.
Line 74
RETURN sends macro execution to the message loop (lines 52-53).
Lines 75-96
LABEL(ScrollCtrl) tests the wParam of the MW_VSCROLL message (line 76).
Line 76
SWITCH tests the sixth element(wParam value passed with WM_VSCROLL) of the callback function array to determine the mouse's location when clicked.
Lines 77-94
See DialogAddScrollBar for details about WM_VSCROLL messages.
Lines 77-78
Scroll bar's right arrow clicked. Call LABEL(LineUp).
Lines 79-80
Scroll bar's left arrow clicked. Call LABEL(LineDown).
Lines 81-82
Area between the right arrow and thumb clicked. Call LABEL(PageUp).
Lines 83-84
Area between the left arrow and thumb clicked. Call LABEL(PageDown).
Lines 85-86
Position of thumb after it is dragged, passed as the low-order word of lParam in the seventh element of the callback function array. Call LABEL(Thumb).
Lines 87-88
Current position of thumb as it is dragged, passed as the low-order word of lParam in the 7th element of the callback function array. Call LABEL(Thumb). Lines 87-88 call the same function as lines 85-86 and have comment marks (//). To test lines 87-88, add comment marks (//) to lines 85-86 and remove them from 87 and 88 (see //).
Lines 89-90
Home key pressed while the scroll bar has the input focus. Call LABEL(PageUp).
Lines 91-92
End key pressed while the scroll bar has the input focus. Call LABEL(PageDown).
Lines 93-94
Scroll bar activity has ended. Display the current thumb position, contained in variable y.
Line 95
ENDSWITCH closes the SWITCH statement (line 76).
Line 96
RETURN sends macro execution to LABEL(MsgLoop) callback function.
Lines 97-101
LABEL(Thumb) retrieves the thumb position after it is dragged (MsgLoop[6] = SB_THUMBPOSITION), or as it is dragged (MsgLoop[6] = SB_THUMBTRACK).
Line 98
Assign the value of MsgLoop[7] (element 7 of the callback function array) to variable y.
Line 99
Calculate the low-order word of variable y using the bitwise AND operator. The value assigned to y is the current thumb position.
Line 100
Call LABEL(TypeFruit) to display the list item that corresponds to the current thumb position.
Line 101
RETURN sends macro execution to LABEL(ScrollCtrl).
Lines 102-109
LABEL(LineUp) is called when the right arrow is clicked to make the current line (value of y) equal to the current thumb position.
Lines 103-105
If the current line is not 1, assign the value of y - 1 to y, and call LABEL(TypeFruit) to display the list item that corresponds to the current thumb position.
Lines 106-107
Beep if the value of y equals 1 (if the first item is displayed). (Try changing this so the last item is displayed.)
Line 108
ENDIF closes the IF statement (line 103).
Line 109
RETURN sends macro execution to LABEL(ScrollCtrl).
Lines 110-117
LABEL(LineDown) is called when the left arrow is clicked to make the current line (value of y) equal to the current thumb position.
Lines 111-113
If the current line is not 10, assign the value of y + 1 to y, and call LABEL(TypeFruit) to display the list item that corresponds to the current thumb position.
Lines 114-115
Beep if the value of y equals 10 (if the last item is displayed). (Try changing this so the first item is displayed.)
Line 116
ENDIF closes the IF statement (line 111).
Line 117
RETURN sends macro execution to LABEL(ScrollCtrl).
Lines 118-121
LABEL(PageUp) is called when the area between the right arrow and thumb is clicked.
Line 119
Assign 1 to variable y to make 1 the current line and thumb position.
Line 120
Call LABEL(TypeFruit) to display the first list item on the first line.
Line 121
RETURN sends macro execution to LABEL(ScrollCtrl).
Lines 122-125
LABEL(PageDown) is called when the area between the left arrow and thumb is clicked.
Line 123
Assign 10 to variable y to make 10 the current line and thumb position.
Line 124
Call LABEL(TypeFruit) to display the last list item on the last line.
Line 125
RETURN sends macro execution to LABEL(ScrollCtrl).
Lines 126-131
LABEL(TypeFruit) displays a list item on the line that corresponds to the current thumb position.
Line 127
Assign blank spaces to variable vBlank to erase the previous list item when a new one is displayed.
Line 128
Erase the previous list item. The vertical position is contained in variable vOldPos that has an initial value of 10 (line 26). This value is updated (line 130) every time LABEL(TypeFruit) is called.
Line 129
Type a new list item at the current thumb position times 10 (the current line position). The current thumb position (value of y) identifies the current list item (List[y]).
Line 130
Assign the current line position to variable vOldPos to be used (line 128) when this subroutine is called again.
Line 131
RETURN sends macro execution to the subroutine's caller.
Lines 132-137
LABEL(MsgBox) is called when the dialog box is activated (lines 67-68). If you click No, the dialog box is activated when the message box is dismissed and LABEL(MsgBox) is called again. The message box is called until the user clicks Yes (lines 134-136).
Line 133
See MessageBox.
Lines 134-136
If variable vStatus equals 6 (Yes chosen), assign 0 to WM_ACTIVATE. Changing the value of WM_ACTIVATE invalidates it as a Windows activate message (lines 30 and 67-68).
Line 137
RETURN sends macro execution to LABEL(MsgLoop) callback function.
Commands that support named parameters
Note
Various commands have been changed to enable the passing of parameter names.
A
AppActivate
AppExecute
AppLocate
Assert
B
Beep
C
Cancel
Chain
CharLen
CharPos
CToN
D
DDEExecute
DDEInitiate
DDEPoke
DDERequest
DDETerminate
DDETerminateAll
DefaultUnits
DllFree
DLLLoad
E
EndPrompt
Error
F
Fraction
G
GetNumber
GetString
GetUnits
N
Nest
NotFound
NToC
NumStr
O
OnCancel
OnCancel Call
OnDDEAdvise Call
OnError
OnError Call
OnNotFound
OnNotFound Call
P
Pause
PersistAll
Prompt
Q
Quit
R
Run
S
SendKeys
Speed
StrLen
StrNum
StrPos
StrUnit
SubChar
SubStr
T
ToLower
ToUpper
U
UnitStr
V
VarErrChk
W
Wait
Application
The product prefix in Application, EndApp, and NewDefault is no longer limited to two characters (it can be the name of the product itself). It is now easier to read a macro when more than one product is involved.
AppActivate
Now accepts a window handle or a string as its first parameter.
AppActivate6023>commands
AppExecute
Now supports starting non-program files using Windows' associations.
AppExecute6025>commands
Assert
Now accepts user-defined conditions. See Assert and OnCondition for a description of how to specify a user-defined condition.
BIF Functions
BIFFilePath, BIFInfo, BIFRead, and BIFWrite are provided for backward compatibility only. Settings are now located in the Windows Registry, and are accessed with the new Registry commands. If you use the BIF commands, you should specify a BIF filename in the BIFFile parameter.
Cancel/Error/NotFound/VarErrChk
Modified to return the previous state (On! or Off!) of a specified condition. Setting a new state is now optional, which means you can get the state (On! or Off!) without changing it.
Cancel
Error
NotFound
VarErrChk
DefaultUnits
Modified to return the previous default units value. You can save the current value, set a new value, then restore the old value. Setting a new value is now optional, which means you can get the default units value without changing it.
None! has been added to the enumeration list of units values. With None! set, no conversion is performed when a non-units value is added to a units value. The non-units value is assumed to be of the same unit type as the units value.
DefaultUnits
Dialog and Region Commands
Previously, DialogDefine created a dialog immediately. Now dialogs are assembled in memory and not actually created until a DialogLoad or DialogShow command. Region commands that reference a dialog or a dialog control will not work until after DialogLoad or DialogShow. Similarly, DialogHandle will not work until after DialogLoad or DialogShow.
Old macros may have to be edited to reflect this change.
Dialog names are now limited to 25 characters in text-based dialog statements (old-style dialogs) and in dialogs created with the Dialog Editor (new-style dialogs).
For all places where a region name is accepted, two special values may be passed:
1. "" If a "" is passed, this is the same as leaving off the region name (where possible) and the current default parent window is used, which is set to the main window of the application that started the macro, but can be changed in the macro at any time using the SetDefaultParent command.
2.
3. "*" If a "8" is passed, the Windows desktop window is used (the same as a NULL window handle).
4.
Dialog Sizing
Specified a dialog size, including the caption and borders. In Windows 95, captions and borders can be sized by the user. To ensure that dialogs display correctly in any environment, dialog sizes no longer include the space occupied by captions and borders.
DialogAdd Commands
You can now add controls to dialogs created with Dialog Editor using DialogAddText, DialogAddListBox, DialogAddPushButton, DialogAddFrame, and so on.
DialogAddCounter
Now accepts counters of various unit formats. When a value is entered with no unit of measure (24 instead of 24i), the value is assumed to be the counter type and not the default units type.
DialogAddCounter
DialogAddFilenameBox
The NoValidate! style is no longer supported because of changes to the Open dialog.
DialogAddFilenameBox
DialogAddScrollBar
Left!, Right!, Top!, and Bottom! styles apply to placing a scroll control within a control window. They no longer apply to placing the thumb within the scroll bar. By default, the thumb is positioned at the minimum position of the scroll bar.
DialogAddScrollBar
DialogDefine
NoFrame! style no longer works. In Windows 95, removing a frame also removes the captions bar. For backward compatibility, the NoFrame! style compiles but is non-functional.
DialogDefine
DialogDismiss and DialogDestroy
Dialogs created with Dialog Editor that have no callback are destroyed when a button is pushed. Subsequent calls to DialogDismiss or DialogDestroy result in run-time error messages (the macro system no longer knows anything about the dialog).
When a callback is declared (see DialogShow), the macro continues to receive and execute instructions (it is not destroyed when a button is pushed). DialogDismiss hides the dialog; DialogDestroy destroys it.
DialogShow
Accepts an optional fourth parameter that specifies a control to receive the initial focus.
The Parent parameter can now be used with text-based (old-style) dialogs.
In callback dialogs, a WM_INITDIALOG (value 272) is now sent in callback array [5] when the dialog is created.
DialogShow
All dialog callbacks should be reviewed and possibly changed to accommodate a 32-bit environment. In particular, entries in the callback array that refer to the wParam (entry [6]), the lParam ([7]), the hiword ([8]), the lParam, and the loword ([9]), should be carefully reviewed. The wParam has been made into a DWord, and many values have been moved between the wParam and the lParam.
DLLCall and DLLCall Prototype
Old macros that use DLLCall must be rewritten to work in Windows 95. DLLs and the APIs provided by the DLLs do not exist or have been modified to work in Windows 95.
DLLCall
ErrorNumber
Is now a programming command that returns the last error number. It appears in the documentation with all other commands. For now, the command does not return any new information.
GetFileDateAndTime
Returns a numeric value representing the date and time the file was written to. This value is comparable to the value returned by DateAndTime, and can be converted to a string with the DateString and TimeString functions.
This command used to return the number of seconds since January 1, 1980 in an undocumented format.
GetFileDateAndTime
IfPlatform
The PlatformID for Windows 95 is Win95! (Win32! is also accepted). The old value of Win! is reserved for 16-bit Windows 3.x.
You can use IfPlatform to start comments, similar to the // command. When the compiler does not recognize a PlatformID value, it ignores all comments between IfPlatform and EndPlatform.
Example
IfPlatform (SomeNotes)
...comment...
...comment...
...comment...
EndPlatform
Result: Comments between IfPlatform and EndPlatform are ignored by the compiler.
NumStr
No longer compatible with WordPerfect's WordPerfect 5.2 for Windows format. You must use the current format and parameter order.
NumStr
OnCancel/OnError/OnNotFound
These commands have been modified to return the label associated with a specified condition (Cancel, Error, or NotFound), as well as to set a new label. If no label was found, "" is returned.
Leaving off the Label parameter resets condition handling to its initial state.
OnCancel
OnError
OnNotFound
Prompt
Accepts a new style named NoButtons! The prompt displays without OK or Cancel buttons, which is useful for displaying "Please Wait" messages.
Prompt accepts another new style named Pause!, which does the same thing as the Pause command.
Pause
Prompt
Region Commands
Cannot be used on a dialog until after DialogLoad or DialogShow. DialogLoad creates the dialog in memory; DialogShow creates the dialog and shows it. Before this happens, regions are not associated with a window and have no meaning.
Storing dialog information and creating the dialog all at once increases performances.
Creating dialogs this way also makes text-based dialogs and dialogs created with Dialog Editor compatible.
Dialog names are now limited to 25 characters in text-based dialog statements (old-style dialogs) and in dialogs created with the Dialog Editor (new-style dialogs).
For all places where a region name is accepted, two special values may be passed:
1. "" If a "" is passed, this is the same as leaving off the region name (where possible) and the current default parent window is used, which is set to the main window of the application that started the macro, but can be changed in the macro at any time using the SetDefaultParent command.
2.
3. "*" If a "8" is passed, the Windows desktop window is used (the same as a NULL window handle).
4.
RegionRemoveListItem
Removes an item with an exact match before it removes an item with a partial match.
RegionRemoveListItem
SetFileDateAndTime
Sets the date and time a file was last written to, using a value returned from the DateAndTime command.
SetFileDateAndTime used to set the date and time as the number of seconds since January 1, 1980.
DateAndTime
SetFileDateAndTime
StrPos
No longer compatible with WordPerfect's WordPerfect 5.2 for Windows. You must use the current format and parameter order.
StrPos
SubStr
No longer compatible with WordPerfect Corporation's WordPerfect 5.2 for Windows. You must use the current format and parameter order.
SubStr
Changing your existing macros to work with PerfectScript
This information is a quick overview of things you may need to do to your existing macros to make them work in PerfectScript.
Keywords
Review variable, label, procedure, and function names, and change them if the name has become a reserved word. New keywords have been added. These keywords are reserved words and may not be used as variable or label names in macros. In addition, the name of any new commands are considered reserved words, since they also cannot be used as variable or label names. Reserved words for lists of reserved keywords.
Arrays
You can pass array slices to repeating parameter groups of commands. In previous versions of PerfectScript, you could pass only entire arrays. Empty slices can now be specified, if the end index is less than the first index.
Negative array indexes can be used in array slices. If negative, the index is considered to be end relative, not start relative. An index of [-1] means the last element, [-2] is the second to last element, etc.
You can assign non-arrays to arrays, and arrays to non-arrays. If an array is assigned to a non-array variable, the assignment is actually made to the array variable with the same name as the non-array variable, and the non-array variable is left untouched. If a non-array is assigned to an array variable, the non-array value is converted into a single element array with that value, and assigned to the array variable.
Non-array values and arrays may be combined with the **(^^) and \ operators.
When a non-array and an array are combined with the following operators, undefined array elements are ignored and skipped over:
&
|
^
<<<
>>>
<<
>>
~
AND
OR
XOR
NOT
**(^^)
+
-
*
/
DIV
MOD
%
\
unary -
comparisons
IN
JavaScript
PerfectScript supports JavaScript. PerfectScript can record macros using the JavaScript programming language. To record JavaScript macros, select Tools, Settings, then click the Record tab. Select JavaScript as the script language.
** Examples
vResult = 2**3
Result: vResult = 8 (2 to the 3rd power)
vResult = 4**2
Result: vResult = 16 (4 to the 2nd power)
+ (string) Example
vStr := "abcdefg" + "xyz"
Result: vStr = "abcdefgxyz"
- (string) Example
vStr := "abcdefg xyz" - " xyz"
Result: vStr = "abcdefg"
IN Example
z := 3 IN {1; 2; 3}
Result: z = True
z := 3 IN (1; 2; 4}
Result: z = False
z := {1; 2; 3} IN {1; 2; 3}
Result: z = True
z := {1; 2; 3} IN {1; 2; 3; 4}
Result: z = True
z := {1; 2; 3} IN {1; 2; 4}
Result: z = False
Rotate left (<<<) Example
-2 <<< 2 is 5
Rotate right (>>>) Example
5 >>> 1 is -2147483646
Bitmaps
Display bitmap graphics. Accept no input, unless used in a callback function with DialogAddHotspot. See DialogAddHotSpot, DialogAddBitmap, and DialogShow.
Date Controls
Display a date. Accept no input. See DialogAddDate.
Progress Indicators
Display a progress indicator. See DialogAddProgress.
Bitwis1e rotate left (<<<) example
x := -2147450881 <<< 1
Result: x equals 65535
Previous Example in binary notation
<<<10000000000000000111111111111111
Result: 1111111111111111 (binary 65535)
Bitwise rotate right (>>>) Example
x := 65535 >>> 1
Result: x equals -2147450881
Previous Example in binary notation
>>>1111111111111111 (binary 65535)
Result: 10000000000000000111111111111111
OLE Object Commands
OLE object commands are called methods, and they perform tasks on an OLE object in a specific OLE automation server.
OLE object methods are specific for each object, such as Excel.Application or Excel.Workbooks. They perform various functions on that object.
OLE object methods that return information about an object are called properties. Many properties have parameters as well as return values. In addition, many properties may be assigned a value by placing them on the left-hand side of the assignment symbol (:=) like the name of a variable.
See OLE Automation for more information about OLE objects.
Glossary of Terms
A
ANSI Character Set
Any (data type)
Argument
B
Boolean (data type)
C
Callback Function
Character Expression (string)
Check Boxes
Command Browser
Command Name
Control Statement
D
Data Type
DLL (Dynamic Link Library)
Drop-down List
E
Edit Boxes
Enumeration
Expression
L
Label
List Box
M
Macro Feature Bar
Measurement
Measurement Expression
N
Numeric Expression (numeric)
Numeric Measurement
O
OLE (Object Linking and Embedding)
Operator
P
PerfectScript
Product Prefix
Prompt
R
Radio Button
Relational Expression
Run-time
S
Scroll Bars
String
T
Toggle
U
User-defined Dialog Box
V
Value Set Member
W
Window
Window Handle
Reserved Words
You should not use reserved words as names for variables, arrays, labels, functions, or procedures. Reserved words include any programming or product macro command.
A
ADDRESS
AND
ANSISTRING
APPACTIVATE
APPEXECUTE
APPLOCATE
APPLICATION
ASSERT
ASSERTCANCEL
ASSERTERROR
ASSERTNOTFOUND
ASSIGN
B
BEEP
BOOL
BREAK
C
CALL
CANCEL
CANCELCONDITION
CANCELOFF
CANCELON
CASE
CASEOF
CENTIMETERS
CHAIN
CHARLEN
CHARPOS
CONTINUE
CTON
D
DDEEXECUTE
DDEEXECUTEEXT
DDEINITIATE
DDEPOKE
DDEREQUEST
DDETERMINATE
DDETERMINATEALLDECLARE
DEFAULT
DEFAULTUNITS
DIGIT
DISCARD
DIV
DLLCALL
DLLFREE
DLLLOAD
DWORD
E
ELSE
ENDAPP
ENDFOR
ENDFUNC
ENDIF
ENDIFPLATFORM
ENDPROC
ENDPROMPT
ENDSWITCH
ENDWHILE
ERROR
ERRORCONDITION
ERROROFF
ERRORON
ERRORNUMBER
EXISTS
F
FALSE
FILE
FOR
FOREACH
FORNEXT
FRACTION
FUNCTION
G
GETNUMBER
GETUNITS
GETSTRING
GLOBAL
GO
H
HIWORD
I
IF
IFPLATFORM
INCHES
INDIRECT
INPUTINTEGER
L
LABEL
LENGTH
LETTER
LOCAL
LOWORD
M
MENU
MENULIST
MILLIMETERS
MOD
N
NEST
NEXT
NEWDEFAULT
NOT
NOTFOUND
NOTFOUNDCONDITION
NOTFOUNDOFF
NOTFOUNDON
NTOC
NUMSTR
O
OEMSTRING
OFF
ON
ONCANCEL
ONDDEADVISE
ONERROR
ONNOTFOUND
OR
P
PAUSE
PERSIST
PERSISTALL
POINTS
POSITION
PROCEDURE
PROMPT
PROTOTYPE
Q
QUIT
R
REALREPEAT
RETURN
RETURNCANCEL
RETURNERROR
RETURNNOTFOUND
RUN
S
SENDKEYS
SPEED
STRING
STRLEN
STRNUM
STRPOS
STRUNIT
SUBCHAR
SUBSTR
SWITCH
T
TOLOWER
TOUPPER
TRUE
U
UNITSTR
UNTIL
USE
V
VALUE
VARERRCHK
VARERRCHKOFF
VARERRCHKON
VOID
W
WAIT
WHILE
WORD
WPSTRING
WPUNITS
WP1200THS
XYZ
XOR
ANSI Character Set
The 256 characters of the American National Standards Institute.
Any (data type)
Accepts more than one data type as input. For example, the command AppActivate (Windows: Any). The Windows parameter accepts a window title (string data type) or a window handle (numeric data type).
Argument
A variable, constant, or expression required by a command or function.
Boolean (data type)
Accepts or returns a value of True or False.
Callback Function
A special function that enables a macro to respond immediately and in specific ways to events such as selecting a radio button or check box, without waiting until a dialog box is dismissed. See DialogShow.
Character Expression (string)
One or more characters enclosed in quotation marks, which identifies the characters as text, not a variable.
Command Browser
The command browser inserts product and/or programming commands into a macro document. Click the Commands button on the macro toolbar, or use MacroCommandInserter in a macro.
Control Statement
Alters the sequential execution of macro commands.
DLL (Dynamic Link Library)
A library of functions and procedures that can be called from a macro.
Drop-down List
A type of list available to a Combo Box control. See DialogAddComboBox.
Expression
Represents values, and can be arithmetic, numeric, measurement, relational, logical, bitwise, or a character string.
Macro Feature Bar
A toolbar that contains tools for writing and editing macros. It contains buttons for saving, compiling, inserting macro commands, and so on. Click Tools Macros Macro Toolbar to display it.
Measurement Expression
A number followed by a unit of measure (", i, c, m, p, w).
Numeric Expression (numeric)
A number on which mathematical operations may be performed. Numeric expressions are not enclosed in quotation marks.
OLE (Object Linking and Embedding)
A feature that copies information from one document to another (embedding), through a "live" link. When the original document changes, the embedded copy reflects the changes.
Operator
A symbol or word that performs a function on one or more expressions. Operators compare expressions, link words together, and perform mathematical functions.
PerfectScript
An application used to record, play, compile, convert, and edit macros. PerfectScript is used to build or edit dialog boxes for macros.
Product Prefix
A two-character expression that specifies a product for a macro command.
Prompt
A message box that displays information for the user.
Relational Expression
An expression that evaluates parameters with only two possible states: TRUE and FALSE.
Run-time
Execution time. Run-time errors occur during macro execution. Run-time options are application start-up settings, such as the macros default directory.
String
A data type that accepts characters enclosed in double quotation marks.
User-defined Dialog Box
A custom dialog box created with Dialog programming commands that display options for user input.
Window
Each window has a title bar, a menu bar, and an Application Bar, and may contain a Property Bar, scroll bar, toolbar, and Ruler. The Equation Editor window has separate editing and display areas called panes.
Window Handle
A unique identifier for a window or control.
Data Type
Defines the set of values that a variable can store. The data types are numeric, string, measurement, boolean, any, enumeration, and label.
Enumerated Type
The parameters for some product commands accept only certain predefined words known as "enumerated types." Enumerated types end with exclamation points. For example, the DisplayMode parameter accepts only Text!, Graphics!, or FullPage!.
Value Set Member
A value in an enumeration list. An enumeration is a data type.
Toggle
A toggle command switches between states. For example, the WordPerfect Bold command can be On! or Off!. If On! or Off! is not specified, Bold "toggles" between the two states each time it is called. If Bold is Off!, it is turned On!. If Bold is On!, it is turned Off!.
Numeric
Pop-up text can be inserted in the ROUTE field of the database or here in the topic file. If you insert it in the database, leave the <ROUTE> style to signal the precompiler to bring in the text. If you wish to enter text in the file, remove the <ROUTE> style.
Label
A subroutine similar to a procedure or function. A Label generally contains one or more statements followed by Return or Quit.
Measurement (data type)
All Measurement return values are returned in WordPerfect units. Necessary unit conversions are done internally when comparing two measurement values. Recorded macros use the units specified in the application preferences. When specifying a measurement value in a product command parameter, WordPerfect units (w) are assumed unless other units are specified in the parameter or with the DefaultUnits command.
Measurement
A data type that accepts a measurement value in inches, millimeters, WP units, and so on. For example, 72P (points) is equal to 1I (inch) and to 2.54C (centimeters).
Command Name
Command names often describe the action, such as Font, MarginLeft, Advance, and FootnoteOptions. Command names execute product features (product commands) or direct the execution of the macro (programming commands, for example, If, Else, End If).
Syntax
The command grammar or sequence: command names, parameter names, and parameter types.
Command Names
There are two general types of macro commands: product commands and programming commands.
Product Commands
Product commands are specific for each application, such as WordPerfect or Corel Presentations. They perform various functions in that application, such as:
* display a dialog box (InitialCodesStyleDlg)
*
* specify settings such as styles (BorderBottomLine), user preferences (PrefZoom), or attributes (Font)
*
* turn features on and off (InhibitInput or TableCellIgnoreCalculation)
*
* perform actions such as inserting a file (FileInsert) or code (PrinterCommand), renaming a bookmark (BookmarkRename), converting comments to text (CommentConvert), or moving the insertion point (PosColBottom)
*
* play macros that are included with the application (FontDnShippingMacro)
*
* Product commands that report information (return value) about the state of an application or feature are sometimes called system variables. In WordPerfect, system variables begin with a leading question mark (?ColumnWidth). In Corel Presentations, they begin with a leading Env (EnvPaths). Some system variables in Corel Presentations have parameters as well as return values.
*
Programming Commands
Programming commands work across applications. Product commands control or return information about applications and feature functions. Programming commands generally control macro functions, such as:
¿ specify conditions under which other macro commands or statements will operate (CASE, IF ELSE ENDIF, SWITCH ENDSWITCH)
¿ repeat macro commands or statements a specified number of times or until certain conditions are met (FOR ENFOR, REPEAT UNTIL, WHILE ENDWHILE)
¿ invoke or jump to a specified subroutine (statement block) with CALL or GO
The Command Inserter keeps programming commands and product commands in separate lists. Click the button under Type to display and select the list you want.
Parameter Names
Using parameter names is optional. InhibitInput (State: Off!) works just like InhibitInput (Off!). Some product commands have no parameters. Their syntax is usually written with empty parameters, such as PosScreenUp(). Some programming commands and WordPerfect system variables have no parameters. Their syntax is the command name alone, such as PAUSE and ?FeatureBar.
Italics
Italics in Macros Help Syntax indicate parameter names or types to be replaced with data. For example, the syntax of GraphicsLineLength is:
GraphicsLineLength (Length: measurement)
After you replace measurement with a number, the command might be:
GraphicsLineLength (Length: 2I)
or
GraphicsLineLength (2I)
Punctuation
Enclose parameters in parentheses. A missing parenthesis, either opening or closing, is a common error that prevents macros from compiling.
Spaces between command names and the opening parenthesis of the parameter section and after semicolons in parameters are optional.
Separate multiple parameters with semicolons(;). If you omit an optional parameter, include the semicolon in the Syntax to keep following parameters in their correct positions. For example,
Enclose repeating parameters in braces. For example, CASE (<Test>: Any; {<Case>: Any; <Label>: label; Case: Any; <Label>: <Label>...}. When data is supplied, the command could be CASE (vChoice; {1; Exclaim; 2; Info; 3; Question; 4; Stop; 5; QuitMacro}; QuitMacro).
Enumerations are identified by a trailing exclamation point (Printer!).
Data Types and Return Values
A data type represents information that is needed by a parameter or returned by a command (return value).
A list of return values shows the possible values that can be returned for that command.
In the command syntax, data types are displayed in italics. For example, the enumerations for the Rotation parameter of BoxCaptionRotation are Degrees90!, Degrees 180!, Degrees 270!, and None!. Only these enumerations can replace the data type in the command syntax. Note that enumerations are identified by a trailing exclamation point.
The most common data types in product commands are string, enum, numeric. Programming commands also frequently use variable.
¿ string Represents text you provide, such as a filename, a dialog box control name, message box text, or a character sequence to insert into a document. Strings may include numbers. Enclose strings in quotation marks. For example, Type ("1") and MESSAGEBOX (vStatus; "VAR" + x; "Continue to next variable?" ; IconQuestion! |YesNo!!)
¿ enumeration Represents options provided by the program, such as styles, types, methods, state, and so on. For example, in WordPerfect, On!, Heading8Style!, and DefFlushRight! are enumerations used by different commands. Enumerations always end with an exclamation point.
¿ numeric Represents a number, such as the number of seconds, a line number, or an outline level.
¿ measurement Represents a unit of measure, such as inches, picas, or WordPerfect units.
¿ token id Represents the name of a macro command (InvokeDialog).
¿ variable A variable name must begin with a letter and is not case sensitive. (Variables in Macro Help examples all begin with a leading v.) Variables can include any combination of letters or numbers up to 50 characters. For example, you could "assign" the value "C:\COREL\OFFICE7\WPWIN7\" to variable "vPath," then substitute the variable for the path in the rest of the macro.
You can change the value of a variable. If variable vNmbr equals 5, then the expression vNmbr := vNmbr + 1 results in vNmbr equaling 6.
Buttons
To see how to record a command, click To Record.
For sample macros and command clusters that use this command, click Example.
Enumerations
Options provided by the program, such as styles, types, and methods, are called enumerations. For example, in WordPerfect, On!, Heading8Style!, and DefFlushRight! are enumerations used by different commands. Enumerations always end with an exclamation point.
Click the red word to read information about that item.