Local and Global Properties for Working with Values
The SenseTalk global and local properties described here affect the way a variety of values are formatted or converted from one type to another (e.g., converting data to text).
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.
the numberFormat
Local Property, the defaultNumberFormat
Global Property
Values: A string made up of a combination of 0s and/or #s, and optionally a decimal point. The 0s to the left of the decimal point indicate how many places will appear in the number, being filled with 0 if the place has no value in the number being formatted. Use #s to the right of the decimal point to have decimal places appear only if they have value. Use 0s to have decimal places appear whether they have value or not.
Default:
- For
the numberFormat
: The current value ofthe defaultNumberFormat
global property - For the
the defaultNumberFormat
: 0.######
Behavior: Use these properties to specify the number of decimal places to use, and number of leading and trailing zeros to show when a numeric value (such as the result of a mathematical operation) is converted to a textual representation.
the numberFormat
property is local to each handler. Setting its value in one handler doesn't affect its value in other handlers called from that handler, or vice versa. When each handler begins running, the numberFormat
in that handler is initially set to the value of the defaultNumberFormat
global property. The global property, the defaultNumberFormat
, is originally set to 0.######, but can be changed if desired.
Special Formats
You can also set the numberFormat
to one of these special values:
hexadecimal
orhex
: Displays numbers in hexadecimal format.octal
: Displays numbers in octal format.binary
: Displays numbers in binary format.words
,Words,
orWORDS
: Displays numbers as words with the corresponding capitalization.
If you want to set the minimum number of digits to display, follow a special value with a number, such as "binary 16". Where necessary, leading zeros are added to make up the minimum length.
Example:
set the numberFormat to "#.###" -- Up to 3 decimal places
Example:
set the numberFormat to "0.00" -- 2 decimal places always
Example:
set the numberFormat to "00.##"
put 3.41 -- Displays 03.41
Example:
set the numberFormat to "00.###"
put 3.41 -- Displays 03.41
Example:
set the defaultNumberFormat to "0.000"
put 3.41 -- Displays 3.410
Example:
set the defaultNumberFormat to "0"
put 3.41 -- Displays 3