Container Properties

Both scripts stored in text files, and objects created dynamically by your scripts as they run can have properties. Most of these properties can be modified by a script. Any modifiable property of an object can be treated as a container.

Script Properties

SenseTalk treats any script stored in a file as an object. All such script objects have a name. The name can be accessed using the name, short name, abbreviated name, and long name properties of the object. The short and abbreviated forms return the name of the script file without any file extension; the long form returns the full pathname of the file. The long id property of any script or object is a unique identifier that can be used to refer to the object. These properties are read-only.

Script files may also define additional properties in a “properties declaration”. These are treated as modifiable custom properties of the object at runtime, which can be manipulated as containers.

Custom Properties

Any object can also have custom properties assigned to it. All such properties are modifiable, and may therefore be treated as containers, as shown in this example:

put new object into sam -- create an object with no properties

put "Sam Adams" into property "name" of sam -- set the name

put 36 into the age of sam -- set the age property to 36

add one to sam's age -- increment sam's age

put "uel" after word 1 of sam's name

put sam.name & ", age " & sam.age -- Samuel Adams, age 37

Objects and their properties, including a number of special properties not mentioned here, are described in detail in Lists and Property Lists, and Objects and Messages.

Local and Global Properties

In addition to properties of objects, there are also a number of properties that do not belong to any one object, but rather to the SenseTalk runtime environment itself. These include “local” properties that apply within the scope of a single handler, such as the numberFormat, the itemDelimiter, and the caseSensitive, and also “global” properties that apply across all handlers during a run, such as the folder, the defaultNumberFormat, the defaultItemDelimiter, the shellCommand, and many others. All of these properties can be treated as containers (just like a variable) for changing their values.

Local and global properties are accessed by using the word the followed by the name of the property. The word the is required to distinguish a local or global property name from a variable name.

Syntax:

the localOrGlobalPropertyName

For additional information about local and global properties, as well as complete lists of the available properties, see Local and Global Properties.

 

This topic was last updated on June 21, 2019, at 02:49:49 PM.

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