You can define labels that accept arguments enclosed in parentheses (). The following example shows a label that increments a variable by a specific value:
Label Name |
Inc(X, STEP) |
Expression |
X = X + STEP |
Here, "X" is the variable to be incremented and "STEP" determines the amount of the increment. You can then use this label in a command, as in the following example:
Key Sequence |
FastInc |
Command |
Inc(SP12, 10); |
An operator can use this command to increment the value of SP12 by 10.
You can also use arguments in a label in the following ways:
You can specify a default value for an argument when you define a label, for example:
Label Name |
Inc(X, STEP = 10) |
Expression |
X = X + STEP |
When you subsequently use this label without any arguments in a command, the default value is used, for example:
Key Sequence |
FastInc |
Command |
Inc(SP12); |
You can pass a string substitution as an argument in a label, for when several variables have part of the variable name in common; for example:
Label Name |
SPDev(TAG) |
Expression |
Prompt("Deviation=" + "IntToStr(CP##TAG## - SP##TAG##)); |
In the above example, TAG is the common portion of the variable name, and is substituted at each occurrence in the expression. To display the difference between two variables CP123 and SP123, you would specify SPDev(123) in a command, for example:
Command |
SPDev(123); |
You cannot use a substitution within a string. In the following example, the DESC Parameter (a text description) will not be substituted as it is between quotation marks:
Prompt("Deviation for ##DESC##=" + "IntToStr(CP##TAG## - SP##TAG##))
See Also
Published June 2018