MESSAGEBOX(z; "Error"; "No values passed"; IconExclamation!)
ENDIF
Result: x y z
numeric or enumeration := MacroCompile
Example
Syntax
(MacroFileName: string; [Options: enumeration])
Description
Compile the specified macro file. If the specified macro file does not exist, a NotFound condition is asserted. Otherwise, MacroCompile returns a success indicator.
Return Value
The enumeration value of Success! if the macro compilation is successful; otherwise the line number and character position within the line of the last syntax error is returned. The line number is stored in the loword of the return value. The character position is stored in the hiword of the return value. These values may be extracted using the following macro code:
x := MacroCompile (file)
vLinenumber := x & 0ffffx
vCharPosition := x >> 16
Success! The macro play was successful.
Parameters
MacroFileName: string The name of the macro file to compile.
Options: enumeration (optional) Determines how the macro is compiled. If missing, Wait! is used.
Wait! Wait for the compile to complete. If Wait! or DontWait! is not specified, Wait! is used.
DontWait! Do not wait for the compile to finish. If Wait! or DontWait! is not specified, Wait! is used.
Debug! Compile the macro for debugging. This is the same as choosing the File/Debug/Compile menu item in Macro Facility.
NoPrompts! Do not display or wait for prompts or dialogs from the macro compiler. Compiler prompts and dialogs are automatically dismissed with the default option for that prompt or dialog. For the syntax error dialog, the default action for syntax warnings is to continue the compile. The default action for syntax errors and fatal errors is to cancel the compile.
ShowProgress! Display the compile progress and compilation summary dialogs during the compile. If NoPrompts! is specified, the summary dialog is automatically dismissed.
GenerateListing! Generate a compiler listing file. If NoPrompts! is specified, prompts that specify the listing file name to overwrite an existing listing file are automatically dismissed. This causes the listing file to overwrite any file by the same name.
ForceRecompile! Recompile the macro even if the macro is already compiled. If NoPrompts! is specified, the prompt to overwrite the up-to-date macro object is automatically dismissed. This causes the macro to be recompiled and to overwrite the macro object if it was already up to date.
ShowIcon! Show an icon in the Windows system tray area while this macro is being compiled. This option only has an effect if the PerfectScript setting "Show Tray Icons" is turned off, since a tray icon is normally always displayed. If turned off, tray icons are not displayed, and this options causes the icon to display.
string := MacroDialogResult
Description
MacroDialogResult is a predefined macro variable that is updated to reflect the status of the Dialog commands. These commands are functions that mostly return the same value placed into MacroDialogResult. The list of commands below are followed by the values placed into MacroDialogResult if successful or if not successful.
Command Name: successful / not successful
DialogDefine: dialog name / empty string ("")
DialogDestroy: True / False
DialogShow (callback dialog): dialog handle / 0
DialogShow (non-callback): control name / empty string ("") The return value for this command is different when the control is the OK or Cancel control. MacroDialogResult returns "1" for OK, and "2" for Cancel. This command returns "OKBttn" and "CancelBttn".
DialogDisplay: True / False
DialogDismiss: control name / empty string ("") See the description of the non-callback DialogShow command above.
DialogUndisplay: True / False
DialogHandle: dialog handle / 0
DialogLoad: dialog handle / 0
DialogSave: True / False
DialogDelete: True / False
DoesDialogExist: True / False
DialogSetProperties: True/ False
DialogControlUpdate: True/ False
DialogControlQuery: True / False
DialogAddListItem: item index / -1
All the following commands return the control name if successful, an empty string ("") if not:
DialogAddBitmap
DialogAddCheckBox
DialogAddColorWheel
DialogAddComboBox
DialogAddControl
DialogAddCounter
DialogAddDate
DialogAddEditBox
DialogAddFileNameBox
DialogAddFrame
DialogAddGroupBox
DialogAddHLine
DialogAddHotSpot
DialogAddIcon
DialogAddListBox
DialogAddPopupButton
DialogAddProgress
DialogAddPushButton
DialogAddRadioButton
DialogAddScrollBar
DialogAddText
DialogAddViewer
DialogAddVLine
numeric or string := MacroInfo
Example
Syntax
(InfoItem: enumeration; [CallLevel: enumeration or numeric]; {[ItemData: any]})
Description
Return information about the system, the state of a macro, or a label or routine within a macro.
Discussion
The macro system keeps track of called labels and routines, the data that is specific to each one, and the call depth of each one. If the main section of a macro calls label "A" which calls procedure "B" which calls function "C," the following is true:
Call depth is 2 (call depth is 0 when the macro starts), and the data for A, B, and C is maintained by the macro system. The current label/routine is C. If data for C is needed, specify CallLevel as Current!. If data for B is needed, specify CallLevel as Previous! (B was the routine that called C). If data for A is needed, specify CallLevel as Previous! + 1. Whenever data is needed for a routine before Previous!, specify CallLevel as Previous! + 1, Previous + 2, and so forth.
You may also specify a numeric value for CallLevel parameters, which simplifies getting data on all active label or routine calls using a For loop. For example, specify Current! as 0, Previous! as 1, the label or routine before Previous! as 3, and so forth. Start the loop at 0, and use MacroInfo (CallDepth!) to end the loop at the call depth return value.
Return Value
string if the platform name is requested, or numeric if the platform version is requested. Some InfoItem values now return an enumeration. The return value for the MacroArgs! And ChainFileArgs! InfoItems can now be an empty array.
Parameters
InfoItem: enumeration Specify an InfoItem (the data type returned is in italics). See the following table for details.
DLLCallBufferSize!
numeric Returns the minimum size of the buffer used when passing string variables by address to DLLCalls. The actual size is the larger of this size, and the current size of the string in the variable being passed by address.
VarErrChkOn!
Boolean Returns the enabled status of the VarErrChk.
VarErrChkSetup!
Boolean Returns True of a label has been established for undefined variable access errors by the OnVarErrChk an OnVarErrChkCall commands.
VarErrChkCall!
Boolean Returns True if a label has been established for undefined variable access errors by the OnVarErrChk command, and False if a label has been established for undefined variable access errors by the OnVarErrChk command.
TokenError!
enumeration Returns the token handler return stutus value from the last token handler to be called, both internal and external. Possible values are:
TokenOK! Formerly value 0. No error.
UnknownToken! Fomerly value -99. No such token.
NotFoundCondition! Formerly value -98. NotFound condition occurred.
CancelCondition! Formerly value -97. Cancel condition occurred.
ErrorCondition! Formerly value -96. Error condition occurred.
InvalidParameter! Formerly value -95. Invalid parameter.
TokenInvalid! Formerly value -94. Token invalid at this time.
NotHandled! Formerly value -93. Token wasn't handled.
DefaultUnits!
enumeration Returns the same value as DefaultUnits command, the current default units type. Possible values are:
None! Formerly value 0.
Centimeters! Formerly value 1.
Inches! Formerly value 2.
Millimeters! Formerly value 3.
Points! Formerly value 4.
WPUnits! Formerly value 5.
CallLevel: enumeration or numeric (optional) Used by some InfoItem types; specifies the label or routine call data is requested for. See Discussion above. Default: Current!
Current!
Previous!
ItemData: any (optional/repeating) Used by some InfoItem types; specifies additional data needed by the specified item. For example, UserDefinedCondition types require the user-defined condition number for which to return information. See OnCondition for specifying a user-defined condition number.
Time Information
ResetTime! Can be used with the Time...! InfoItem values to reset the specified interval timer to zero. (It cannot be used with the TimeWindowsStarted! or TimeWindowsElapsed! Values.)
Information Type Return Value
System Information ComputerName! string Name assigned to the computer.
UserName! string Name of currently logged-in user.
WindowsDirectory! string Windows directory path.
SystemDirectory! string Windows System directory path.
PlatformName! string Name of the current platform. Currently the platform names that are returned are:
"Win32s" for Windows 3.1 with Win32s
"Win95" for Windows 95
"Win98" for Windows 98
"WinNT" for Windows NT
."Win2000" for Windows 2000
."Win32??" for unrecognized version of Windows 32
."WinNT??" for unrecognized version of Windows NT
."CorelWine" for Corel Linux version
PlatformVersion! numeric Version of the platform.
PlatformVersionString! string Version of the platform.
PerfectFitVersion! numeric Version of PerfectFit.
PerfectFitVersionString! string Version of PerfectFit.
PerfectScriptVersion! numeric Version of PerfectScript.
PerfectScriptVersionString! string Version of PerfectScript.
PerfectScriptLanguageCode! string Language code of PerfectScript.
PerfectScriptLanguageName! string Language name of PerfectScript.
SpeedDelay! (Numeric) Return the current delay set by the speed command.
Macro Information DialogsExist! boolean Do macro dialogs exist.
BreakpointsExist! boolean Do macro break points exist.
ErrorNumber! Returns the same value as the ErrorNumber command. It returns the following values:
Success! Formerly value 0. There was no error.
CancelConditionAsserted! Formerly value 1. A Cancel condition was asserted.
ErrorConditionAsserted! Formerly value 2. An Error condition was asserted.
NotFoundConditionAsserted! Formerly value 7. A Not Found condition was asserted.
UserDefinedCondition! Formerly value 100. The value defines the base value for assertions of user defined conditions. See the Assert command for more information about the value of user defined condition codes.
VarErrChkAsserted! A VarErrChk condition was asserted. This occurs when a unhandled access to an undefined variable occurs.
ErrorText! string Additional error text associated with the last error.
TokenError!enumeration Returns the token handler return status from the last token handler to be called.
AbortingTokenName! string Name of the product command token (if any) that caused the last error.
MacroDialogResult! any Same as MacroDialogResult.
MacroArgs! array The array of argueents passed to the macro on startup.
CallDepth! numeric The current call depth: 0 = main.
Label or Routine Information InRoutine! boolean Are you in a routine (or label).
InCallback! boolean Is this a callback.
InAssert! boolean Is this an Assert call.
FileName! string File the routine is in.
LineNumber! numeric Source line number.
LabelOrRoutineName! label Label or routine name.
SourceLine! string Source line if available for the specified CallLevel (source is available for macros compiled with debug).
ChainFileName! string Name of any Chain file.
ChainFileArgs! array Arguments to any Chain file, if the Chain macro is setup.
DefaultUnits! Returns the same value as the DefaultUnits command.
PersistAllOn! boolean State of PersistAll.
VarErrChkOn! boolean State of VarErrChkOn.
CancelOn! boolean State of Cancel condition.
CancelSetup! boolean Does Cancel condition have an associated label.
CancelCall! boolean Will Cancel call or goto an associated label.
CancelHandler! label Label of the cancel handler.
ExitOn! Return the exit handler state. Equivalent to ExitHandlerState() = ExitHandlerState.On!
ExitSetup! Return whether an exit hanlder has been established. Equivalent to the statement OnExit() != ""
ExitCall! Return True if an exit handler has been established.
ExitHandler! Return the label of the established exit handler. Equivalent to OnExit()
ErrorOn! boolean State of Error condition.
ErrorSetup! boolean Does Error condition have an associated label.
ErrorCall! boolean Will Error call or goto an associated label.
ErrorHandler! label Label of the error handler.
NotFoundOn! boolean State of NotFound condition.
NotFoundSetup! boolean Does NotFound condition have an associated label.
NotFoundCall! boolean Will NotFound call or goto an associated label.
NotFoundHandler! label Label of the NotFound handler.
VarErrChkOn! boolean Returns whether VarErrChk is currently enabled.
VarErrChkSetup! boolean Returns True is a label has been established for undefined variable access errors by the OnVarErrChk and OnVarErrChk Call commands.
VarErrChkCall! boolean Returns True is a label has been established for undefined variable access errors by the OnVarErrChk Call command and False if a label has been established for undefined variable access errors by the OnVarErrChk command.
VarErrChkHandler!label Returns the label to be called or jumped to if an undefined variable is accessed.
UserDefinedConditonOn! Boolean Is a user-defined condition on.
UserDefinedConditionSetup! Boolean Does a user-defined condition have an associated label.
UserDefinedConditionCall! Boolean Will UserDefinedCondition call or goto an associated label.
UserDefinedConditionHandler! label Label of the UserDefined condition.
Time Information The time commands may be used to examine and extract field from the return value.
TimeWindowsStarted! numeric Returns the starting time of the current Windows session.
TimeWindowsElapsed! numeric Returns the elapsed time of the current Windows session.
TimeMacroStarted! numeric Returns the starting time of the current running macro.
TimeMacroElapsed! numeric Returns the elapsed time of the current running macro.
TimeElapsedNet! numeric Returns the elapsed time the current macro has spent in the macro system (TimeElapsed!- TimeInProductCalls!-TimeInDLLCalls!- TimeInOleOjects!).
TimeInProductCalls! numeric Returns the elapsed time the running macro has spent in calls to product commands of other Corel applications.
TimeInDLLCalls! numeric Returns the elapsed time the current macro has spent in calls to DLL routines.
TimeInOleOjects! numeric Returns the elapsed time the current macro has spent in calls to OLE automation objects.
DLLCallBufferSize! numeric Returns the minimum size of the buffer used when passing string variables by address to DLLCalls.
numeric := MacroIsCompiled
Example
Syntax
(MacroFileName: string)
Description
Determine if a specified macro file is compiled. If the specified macro file does not exist, a NotFound condition is asserted. Otherwise, MacroIsCompiled returns the compiled status of the macro file.
Return Value
True if the macro is compiled and up to date, False if not.
Play the specified macro file. The macro runs as a completely independent macro in parallel with the current macro. If the specified macro file does not exist, a NotFound condition is asserted. Otherwise MacroPlay returns a success indicator.
Return Value
The enumeration value of Success! if the macro compilation is successful, or the line number where the macro terminated with an error if the macro compilation is not successful.
Success! The macro play was successful.
Parameters
MacroFileName: string The name of the macro file to play.
Options: enumeration (optional) Determine how the macro is played. If missing, Wait! is used.
Wait! Wait for the play to complete. If Wait! or DontWait! is not specified, Wait! is used.
DontWait! Do not wait for the play to finish. If Wait! or DontWait! is not specified, Wait! is used.
Debug! Play the macro with the macro debugger. This is the same as choosing the File/Debug/Play menu item in the Macro Facility.
ShowIcon! Show an icon in the Windows system tray area while the macro is being played. This option only has an effect if the PerfectSript setting "Show Tracey Icons" is turned off, since a tray icon is normally displayed by default.
Parameter: any (optional, repeating) Values passed to the macro in the MacroArgs[ ] array variable.
numeric := MantissaPart
Syntax
(Value: numeric)
Description
Get the mantissa portion of a numeric value.
Example
vMntsa := MantissaPart(3.2e18)
Result: vMntsa = 3.2
Return Value
Mantissa portion of a numeric value.
Parameters
Value: numeric A fractional number (return the mantissa part of).
numeric := MaxN
Syntax
([Nth: numeric]; [Value: numeric])
Description
This command returns the Nth largest value in a list of values.
Return Value
The Nth largest value.
Parameters
Nth:
numeric Which largest value to return. If 1 is passed, the largest value is returned. If the list has 10 values, then the 10th largest value is the smallest value.
Value: numeric The list of data values to return the Nth largest value of.
Display a menu of user-defined items. The parent of this dialog is maintained by the macro and is initially set to the application that started the macro. The dialog may be attached to a different application or window by setting a new default parent with the SetDefaultParent command.
Menu is used with statements such as Case, Case Call, and If to execute a statement that corresponds to a selected menu item. To dismiss a menu, press Alt or Esc.
Return Value
Returns the index number of th item that was selected, starting at 1. A value of 0 is returned if there is an error or if the menu was cancelled.
Parameters
<MenuPick> variable A number is returned in this variable whether numbers or letters are used to reference menu items (see the MenuType parameter). For numbers, the range is 1 to 9. For letters, the range is 1 to 26. A returns 1, B returns 2, and so forth. 0 is returned if Alt or Esc is pressed.
<MnemonicType> enumeration
(optional) Determine whether a letter or number is displayed to the left of a menu item. If missing, Either! Is used. For Letters! And Digits!, the character just after "&" will be used as the accelerator (the & is them removed). All excess "&" characters are removed from the menu item strings.
Digit! Numbers (1-9)
Letters! Alphabetic characters (A-Z)
Either! If there are more than 9 menu items, the items are given mnemonics of letters, otherwise they are given mnemonics of digits.
<HorizontalPosition> numeric (optional) The number of pixels from the left side of the main window to the left side of the menu. To center the menu horizontally, leave this parameter blank.
<VerticalPosition> numeric (optional) The number of pixels from the top of the main window to the top of the menu. To center the menu vertically, leave this parameter blank.
{<MenuChoice> string} The menu item text. You may list up to 9 menu items referenced by numbers, or up to 26 referenced by letters. Enclose menu items in braces ({ }) separated by a semicolon.
Display a message box. The parent of this dialog is maintained by the macro and is initially set to the application that started the macro. The dialog may be attached to a different application or window by setting a new default parent with the SetDefaultParent command.
Provide a limited set of buttons and icons, and an option to include up to 10 different parameter strings in the message.
Return Value
The control value of the button that dismisses the message box is returned in this variable. The return button values are:
Error!
OKButton!
CancelButton!
AbortButton!
RetryButton!
IgnoreButton!
YesButton!
NoButton!
If there is not enough memory to create the message box, 0 is returned.
Parameters
Status: variable (optional) The control value of the button that dismisses the message box (see Return Value above).
Caption: string (optional) The title bar text. Default: "PerfectScript"
Message: string The message box text. Icons appear to the left of the message. Control buttons are centered below the message. If HasParameters! style is used, a caret (^) followed by a number inserts the corresponding ParameterData message in its place (see the ParameterData parameter below). Use two carets (^^) to insert a caret as part of the message string. Use NToC(0F90Ah) to insert a hard return code in the message string. For example,
Style: enumeration (optional) The message box styles. Type | between enumerations to combine styles. Select only one style from each group
Default: OK! | IconNone! | DefButton1! See the table below for more details about enumerations.
{ParameterData: string} (optional) The text for the Message parameter (numbering begins with 0). Up to 10 parameters separated by semicolons are allowed. For example,
fills the Message parameter with "Select Yes to continue, or No to quit." If HasParameters! is not used, Message contains "Select ^0 ^1".
If not specified, no parameters are substituted into Message.
Type of Enumerations Enumerations
Button enumerations are: AbortRetryIgnore! (Abort, Retry, and Ignore)
OK! (OK - default if no button is specified)
OKCancel! (OK and Cancel)
RetryCancel! (Retry and Cancel)
YesNo! (Yes and No)
YesNoCancel! (Yes, No, and Cancel)
Icon enumerations are: IconNone! (No icon (default if no icon is specified))
IconAsterisk! (Lowercase "i" in a blue circle)
IconExclamation! (Exclamation point in a yellow circle)
IconHand! (Stop sign in a red circle)
IconInformation! (Lowercase "i" in a blue circle)
IconWarning! (Exclamation point in a yellow circle)
IconError! (Stop sign in a red circle)
IconQuestion! (Question mark in a green circle)
IconStop! (Stop sign in a red circle)
Default button enumerations are: DefButton1!
DefButton2!
DefButton3!
Modality enumerations are: ApplicationModal! (You can switch to another application, but you must dismiss the message box (click a control button) before the macro resumes. ApplicationModal! is the default if either SystemModal! or TaskModal! is not specified.)
SystemModal! (You must dismiss the message box before the macro resumes, and before you can switch to another application.)
TaskModal! (You can switch to another application, but you must dismiss the message box (click a control button) before the macro resumes.)
Miscellaneous enumerations are: Beep! (Beep when the message box is displayed.)
HasParameters! (Notifies MessageBox box that a caret (^) followed by a number in the Message parameter is to be replaced by the corresponding character string in the ParameterData parameter.)
numeric := MeanDev
Syntax
([Type: enumeration]; [Value: numeric])
Description
This comand computes the statistical mean deviation of a list of data values.
Return Value
The mean deviation of the data.
Parameters
Type:
enumeration Whether the list of data values represents the entire population of data values, or just a sample of the data values. If missing, Population! is used.
Population! The list of data values is the entire set of data values.
Sample! The list of data values represents just a sample of the entire set of values.
Value: numeric The list of data values to compute the mean deviation for.
numeric := Min
Syntax
({Value: numeric})
Description
Get the minimum value of a list of values.
Return Value
Minimum value of a list of values.
Parameters
Value: numeric The list of values. Separate multiple values with a semicolon.
numeric := Median
Syntax
([Value: numeric])
Description
This command returns the median of a list of data values. The median is the value that is located at the halfway point between the largest and smallest values. If the number is even, then the average of the 2 middle values is returned.
Return Value
The median value of the data values.
Parameters
Value: numeric The list of data values to return the median for.
numeric := MMPlay
Example
Syntax
(Filename: string; [Options: enumeration])
Description
Play a sound file.
Play a audio (WAV) file, an Audio-Visual Interleave (AVI) movie file, or a Musical Instrument Digital Interface (MIDI) file, or speaks an ASCII text file (see MMSpeak). Speech requires text-to-speech drivers like those shipped with some sound boards. Audio and MIDI files require the appropriate sound card.
Return Value
A handle that can be passed to MMStopPlay.
Parameters
Filename: string The path and name of a sound file. The appropriate driver for each file type must be installed.
DontWait! Start playing and go immediately to the next macro statement (has no effect on some systems).
Wait! Start playing and wait for play to finish before going to the next macro statement.
MMSpeak
Example
Syntax
(String: string)
Description
Speak an ASCII file or ASCII text.
Parameters
String: string The path and name of an ASCII file, or a string, or a variable containing a string. A text-to-speech driver must be installed in the Windows 95 System directory. Products supported are: Lernout and Hauspie, Centigram TruVoice, and CreativeTextAssist (SoundBlaster).
MMSpeakClipboard
Example
Syntax
()
Description
Speak text saved to the Clipboard.
A text-to-speech driver must be installed. Products supported are: Lernout and Hauspie, Centigram TruVoice, and the Creative TextAssist.
numeric := MinN
Syntax
([Nth: numeric]; [Value: numeric])
Description
This command returns the Nth smallest value is a list of values.
Return Value
The Nth smallest value.
Parameter
Nth:
numeric Which smallest value to return. I 1 is passed, the smallest value is returned. If the list has 10 values, then the 10th smallest value is the largest value.
Value: numeric The list of data values to return the Nth smallest value for.
MMStopPlay
Syntax
(Handle: numeric)
Description
Stop a multimedia file started with MMPlay, with the DontWait! option set. With the Wait! option set, MMStopPlay has no effect.
Parameter
Handle: numeric Returned by MMPlay.
MMStopSpeech
Example
Syntax
()
Description
Stop a speech (text) file started with MMPlay (ASCII file), MMSpeak, or MMSpeakClipboard.
After a text file begins to speak, control immediately returns to the macro. Use MMStopSpeech to stop speaking a text file.
numeric := numeric MOD numeric
Description
Operator. Precedence level 3.
Return Value
Return the integer remainder of the quotient of two numbers.