All statements between Else and Endif are executed when the If expression is False. See If.
ElseIfPlatform
Syntax
([{<PlatformID>enumeration}])
Description
Works with IfPlatform and EndIfPlatform statements, similar to the Else statement in an If-Else-Endif control statement except that a new platform ID may be specified.
Parameters
<PlatformID> enumeration (optional, repeating) List of platform IDs to test. If the ID of the current platform is specified, only the statements up to the next ElseIfPlatform statement are included in the macro (all others are ignored). If missing, the current "ignore" state is reversed (ignored statements are compiled up to the next ElseIfPlatform statement). Statements that would have been compiled are ignored; statements that would have been ignored are compiled.
_Version9_0_0! This enumeration is recognized if the macro is compiled using the version 0 PerfectScript macro system.
_Version9_0_1!
_Version9_0_3!
_Version9_0_4!
Win2000! Windows 2000 platform
CorelWine! Synonym for Linux in the Linux version of the Suite.
EndApp
Example
Syntax
(<ProductPrefix> identifier)
Description
Identify, for the compiler, an application that is no longer used in a macro (see Application).
Parameters
<ProductPrefix> identifier A unique identifier that must match the ProductPrefix parameter of an Application statement, or the prefix of an OLE object variable. This command is a compile time only statement, and removes a product or object prefix from the product name list maintained by the macro compiler. If the prefix of the current default object or product is removed, the previous default prefix becomes the new default prefix.
Note
EndApp is a non-executable statement that can occur anywhere in a macro. After EndApp, a product command to the application specified by EndApp creates a compile-time syntax error.
EndFor
Description
Close a For control loop. See For.
EndFunc
Description
Close a Function statement (synonym for EndFunction). See Function.
EndFunction
Description
Close a Function statement (synonym for EndFunc). See Function.
EndIf
Description
Close an If control statement. See If.
EndIfPlatform
Syntax
([{<PlatformID>enumeration}])
Description
Close an IfPlatform conditional compile statement. See IfPlatform. The parameter is optional and ignored. Its only purpose is to document what it goes with.
EndProc
Description
Close a Procedure statement (synonym for EndProcedure). See Procedure.
EndProcedure
Description
Close a Procedure statement (synonym for EndProc). See Procedure.
Set the value of an environment variable, or delete it.
Parameters
EnvVariableName: string The environment variable name.
Value: string (optional) The value to assign to the variable. If missing, the environment variable is deleted.
EnvType: enumeration (optional) The type of variable. Default: DOS!
DOS!
enumeration := Error
Example
Syntax
([State: enumeration])
Description
Determine how a macro responds to an Error condition.
Create an Error condition with Assert(ErrorCondition!).
Return Value
Off! Previous state was Off!
On! Previous state was On!
Parameters
State: enumeration (optional) Specify the Error state. The default is Error(On!). If missing, the current state is returned without changing it.
Off! Ignore an Error condition.
On! Stop a macro unless preceded by OnError, which directs macro execution to a specified Label.
enumeration := ErrorNumber
Description
Return the error value of a Cancel, Error, Not Found, or user-defined condition.
ErrorNumber is a macro system variable that returns an enumeration, which can be referred to by name. The enumerations have the same numeric values as in previous versions. The value of ErrorNumber is cleared before every command. After the command is executed, ErrorNumber returns a value that indicates if an error occurred. If a handler condition is disabled, the macro continues when the specified condition occurs. You can test ErrorNumber manually for ErrorNumber.Success!. Commands that do not reset ErrorNumber are MacroInfo.
(ErrorNumber!) calls, ErrorNumber itself, and compound statements, such as If-Endif, Switch-EndSwitch, Repeat-Until, While-EndWhile, For-EndFor, and so on. Copy the value returned by ErrorNumber into a variable if the value is needed after executing other macro commands, such as PROMPT, which reset ErrorNumber.
Return Value
Success! Formerly value 0.
CancelConditionAsserted! Cancel condition was asserted. Formerly value 1.
ErrorConditionAsserted! An Error condition was asserted. Formerly value 2.
NotFoundConditionAsserted! A Not Found condition was asserted. Formerly value 7.
UserDefinedCondition! This 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! An undefined variable was accessed.
enumeration or boolean:= Exists
Example
Syntax
(VariableName: variable; [Pool: enumeration])
Description
Determine if a variable exists.
To exist, a variable must be declared and initialized. Given that variable w is declared and not initialized, and that Local x is initialized to 5, Global y to 10, and Persist z to 15, the following statements are valid:
vNoInit := Exists(w)
Result: vNoInit equals Exists.NotFound!
vLocal := Exists(x)
Result: vLocal equals Exists.Local!
vGlobal := Exists(y)
Result: vGlobal equals Exists.Global!
vPersist := Exists(z)
Result: vPersist = Exists.Persistent!
Examples in shorthand notation
If(Exists(vLocal))
Beep
EndIf
Explanation: Computer beeps because Exists returns a value other than Exists.NotFound!.
If(Exists(vLocal) = Exists.Persistent!)
Beep
EndIf
Explanation: The computer does not beep because Exists returns Exists.Local!. (vLocal is a Local variable, not a Persist variable.)
Return Value
If Pool is left off, the values are:
NotFound! Variable does not exist.
Local! Variable exists in local pool.
Global! Variable exists in global pool.
Persistent! Variable exists in persistent pool.
If Pool is specified, the return value is True (exists in the pool specified by the Pool parameter) or False (does not exist).
Parameters
VariableName: variable A variable declared as Local, Global, or Persistent. Variables begin with a letter and can include any other combination of letters or numbers.
Pool: enumeration (optional) If missing, the command returns the Pool the variable is in. If provided, the command returns boolean True or False indicating whether the variable is in the specified Pool.
Local! See if the variable exists in the local variable pool.
Global! See if the variable exists in the global variable pool.
Persistent! See if the variable exists in the persistent variable pool.
enumeration := ExitHandlerState
Syntax
([State: enumeration])
Description
Determine how a macro responds to an Exit condition.
Create an Exit condition with Assert(ExitCondition!).
Unlike Error, Cancel, and NotFound, ExitHandlerState neither enables nor prevents a condition from occurring. It enables or disables calling the exit handler when an exit condition occurs.
Return Value
Off! Previous state was Off!
On! Previous state was On!
Parameters
State: enumeration (optional) Specify the Exit state. If missing, the current state is returned without changing it. Default: Exit(On!).
Off! Disable exit handler condition calling.
On! Enable exit handler condition calling.
numeric := ExponentPart
Syntax
(Value: numeric)
Description
Return the exponent portion of a numeric value.
For example, the exponent of 3.2e18 is 18.
Return Value
Exponent portion of a numeric value.
Parameters
Value: numeric A fractional number (return exponent part of).