Global Properties for SenseTalk Variables
SenseTalk includes several global properties that let you control how you can access and work with variables in your scripts.
For information about working with variables in SenseTalk, see Variables.
Setting or Changing Local and Global Property Values:
You can set a global property value with the SenseTalk commands Set
or Put
. Note that when you reference one of these properties, you must use the word the
before the property name to distinguish it from an ordinary variable.
Examples:
set the searchrectangle to [1,2,2,3]
put 2 into the remoteworkinterval
You can add or change specific named properties within a global property like this:
set the namedColors.pink to color("RGB,1.0,0.5,0.5") -- Adds pink to the namedColors global property and defines its RGB color value
set the listFormat's separator to " & " -- Sets the separator property of the listFormat global property
Properties can also be set or updated by using the setoption
or setoptions
commands. The setoption
command lets you update a single property, and setoptions
lets you update multiple properties.
Examples:
setoption searchrectangle, [1,2,2,3]
setoptions {searchrectangle: [1,2,2,3], scriptlogging: yes}
Because setoption
and setoptions
are specific for use with global and local properties, you omit the word the
from the property name in the command syntax for these commands.
For additional information about working with local and global properties, see Local and Global Properties in SenseTalk.
Related Global Property
SenseTalk includes a related global property as part of the properties that are specific to working with scripts in Eggplant Functionall. the suiteVariables
property lets you set or modify suite-wide variables that act as predefined local variables. For complete information about the suiteVariables
, see Eggplant Functional Global Properties.
the predefinedVariables
Global Property
Values: A property list containing definitions of variables
Default: For a list of current predefined variables, see Predefined Variables Provided or run the following command:
put the predefinedVariables
Behavior: This property is a property list containing the definitions of all the predefined variables. Any changes made to this property affect any subsequent use of an unassigned variable whose name is one of its keys. By modifying this property, predefined variables can be created or removed during a run, or their value can be changed.
Example:
set the predefinedVariables.twelve to "⓬"
put twelve // ⓬
Example:
log checkMark repeated 5 times // Logs '✓✓✓✓✓'
set the predefinedVariables's checkMark to "☑"
log checkMark repeated 5 times // Logs '☑☑☑☑☑'
the evaluationContext
Global Property
Values: Local
, Global
, Universal
Default: Local
Behavior: This property determines the scope of variables in do
, send
, value()
, and merge()
expressions. Local variables have the context of a single handler in a script. Global variables can be referenced from any handler within a project, and they retain their value between different handlers. Universal variables retain their values between runs during an entire session.
Example:
set the evaluationContext to "global"
Example:
set global myName to "Carrie"
put merge("My name is [[myName]]") // Displays 'My name is myName'
set the evaluationContext to "global"
put merge("My name is [[myName]]") // Displays 'My name is Carrie'