Local and Global Properties in SenseTalk

In SenseTalk, local and global properties are system-wide values that determine behaviors of the run environment. Essentially, these special properties are containers that can accept certain values to set the available options for the property.

For instance, a simple global property such as the strictFiles might take only true or false values to determine whether the feature is enabled or disabled. Other properties, such as the timeFormat, might have a larger list of acceptable values, defining the formats you can set for that data type.

SenseTalk includes both local properties, which affect the environment only of the local handler, and global properties, which affect the whole runtime environment. In addition, there are global properties that are specially defined to work with Eggplant Functional: Eggplant Functional global properties, and Run Options global properties.

You can find lists of the available local and global properties on the following page:

Using Global Properties with SenseTalk Commands

Within your SenseTalk scripts, you can set or change global property values. In fact, you can change them on a script-by-script basis, or even multiple times within a single script.

You can set a global property value with the SenseTalk commands Set or Put.

Note: 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

For additional information, see Container Properties.

Using Global Properties with SetOption and SetOptions

Typically, you'll find it easiest to set global property values by using set or put commands, as described above. However, the setOption and setOptions commands are also available, and can let you update multiple properties at once.

When you use these commands to set a global property value, you do not insert the word the before the name of the global property. (SetOption and setOptions are commands that take only global properties as parameter values, so there is no need to distinguish a global property with the.)

To set multiple global properties at once, use the setOptions command, and pass a global property list in parentheses, as you would always pass a list.

Examples:

setoption searchrectangle, (1,2,2,3)

setoptions (searchrectangle: (1,2,2,3), scriptlogging: yes)

Note: To save the default settings, add the following piece of SenseTalk code to the beginning of a script run. This code stores the default settings into a global variable:

put GetOptions("RunOptions") into global defaultRunOptions

You can then restore the default settings using the following SenseTalk code:

SetOptions global defaultRunOptions

For complete information about these commands, see SetOption, SetOptions Commands.

GetOption and GetOptions Functions

The getOption and getOptions functions return the value of a global property (getOption), or list of global properties (getOptions). Enclose single global properties and global property lists in parentheses, as you would for any function.

Examples:

put getOption (searchrectangle)

put getOptions (searchrectangle, scriptlogging)

For complete information about these functions, see GetOption, GetOptions Functions.

 

This topic was last updated on August 19, 2021, at 03:30:51 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant