Local and Global Properties for Chunk Expressions
Chunk expressions provide a powerful way of handling text data in SenseTalk scripts. The local and global properties described here let you control how chunks are accessed. For additional information about using chunks in SenseTalk, see Chunk Expressions.
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 wordDelimiter Local Property, the defaultWordDelimiter Global Property
,
Values: Any character or list of characters, which will serve as separators between words in a container
Default:
- For
the wordDelimiter: The current value ofthe defaultWordDelimiterglobal property - For
the defaultWordDelimiter: Space, Tab, and Return
Behavior: These properties specify the set of characters recognized as separators between words in a container. Any sequence of these characters, in any order or combination, can appear between words.
the wordDelimiter 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 wordDelimiter in that handler is initially set to the value of the defaultWordDelimiter global property.
Example:
set the wordDelimiter to "." // Changes the local word delimiter to period
Example:
put "A man, a plan, a canal. Panama!" into palindrome
put word 4 of palindrome //Returns 'plan,'
set the wordDelimiter to ".,!?;:" & space & tab
put word 4 of palindrome //Returns 'plan'
set the wordDelimiter to ",."
put word 4 of palindrome //Returns ' Panama!'
Example:
set the defaultWordDelimiter to " " // Changes the word delimiter to space across all handlers
Example:
set LookupNumber to "102,311,421.000.631.521"
set the DefaultWordDelimiter to comma&period
set Row to the fifth word of LookupNumber
log Row // Displays '631'
You can also specify a delimiter directly in a word chunk expression by including a delimited by clause, as described in Custom Chunks.
Related:
the lineDelimiterthe itemDelimiter
the wordQuotes Local Property, the defaultWordQuotes Global Property
Values: A list of two values for the beginning and ending quote delimiters, or a single value that will be used as both the beginning and ending delimiters. You can also set it to empty or None to disable word quoting, or to Standard to restore the default quoting.
Default:
- For
the wordQuotes: The current value ofthe defaultWordQuotesglobal property - For
the defaultWordQuotes: Straight double quotation marks
Behavior: These properties specify the quote character or characters used to identify quoted "words" in a word chunk. By default, any word beginning with a double quote character will include all characters up to and including the next double quote character (including any enclosed characters from the wordDelimiter local property).
the wordQuotes 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 wordQuotes in that handler is initially set to the value of the defaultWordQuotes global property.
Example:
set the wordQuotes to "*"