Local and Global Properties for Lists and Property Lists
The SenseTalk global and local properties described here control behaviors of lists and property lists in your scripts. You can set or change these options to affect formatting, insertion methods, and other actions to customize your environment.
For complete information about lists and property lists in SenseTalk, see Lists and Property Lists.
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 listFormat
Global Property
Values: A property list including three required values, and optionally two additional values:
prefix
: The character that precedes the list when converted to text.separator
: The character that appears between each item of the list when converted to text.suffix
: The character that ends the list when converted to textquotes
(optional): This property defines the manner in which values in the list are quoted. By default, thequotes
value is not set for lists, so the setting ofthe defaultQuoteFormat
global property controls quoting of list values.indent
(optional): This property can be set to a text value that will be used for indenting items in the list. If you set anindent
value, individual list items are displayed on separate lines with values indented by multiples of the indent value, according to the nesting of the structure.
Default: Only the three required values are set initially:
prefix
: [separator
: ,suffix
: ]
Behavior: This global property defines the format used to convert a list into a text format. When displaying a list as text, the list is surrounded by the prefix and suffix values, with the separator value used between each item of the list.
Predefined values for the listFormat
include boxListFormat
, jsonListFormat
, and standardListFormat
.
Example:
set the ListFormat's separator to period // Uses the 'period' keyword to set the ListFormat's separator to "."
Example:
set the listFormat's quotes to "^"
put ["cheese","meat","fruit"] // Displays '[^cheese^,^meat^,^fruit^]'
Example:
set the listformat to {separator:";"}
put ["cheese","meat","fruit"] // Displays 'cheese;meat;fruit'
Example:
set the ListFormat.prefix to "-->"
put ["cheese","meat","fruit"] // Displays '-->cheese,meat,fruit]'
Example:
set the ListFormat to {separator:";",quotes:"^"}
put ["cheese","meat","fruit"] //Displays '^cheese^;^meat^;^fruit^'
Example:
set the listformat to boxListFormat
put (1,2,3,5,7) // Displays 【1】 【2】 【3】 【5】 【7】