Syntax: Data Types

OpusScript supports six types of data types: numbers; boolean values; strings; objects; null; and undefined. A variable can contain any of these data types.

Numbers:

Numbers can be either Integers or fractional numbers (also known as floating-point numbers). In practical terms, you do not have to worry how you enter a number unless you are going to do more complex mathematical or scientific calculations.

image\Script_Button.jpgExamples

Boolean values:

There are only two types of Boolean values: true or false. These values equate to yes and no and are the backbone of any decision-making statements you enter in an OpusScript. The Boolean values true and false are colour-coded blue in an OpusScript for ease of identification.

image\Script_Button.jpgExamples

String:

A string is any combination of alphabetic or numeric characters surrounded by single or double quote marks. The string must be surrounded by the same style of quote marks i.e. single or double. One style of quote marks can be contained within the other style. A string is colour-coded gold in an OpusScript for ease of identification.

image\Script_Button.jpgExamples

Object:

A variable can also hold the values of a new object. This object can have properties that have been added to it when you have used a Get function, such as, GetSelectionParagraphStyle. Alternatively, you can create your own object and give it properties – this is commonly done if you want to set new properties using some of the Set functions, such as, SetSelectionParagraphStyle.

image\Script_Button.jpgExamples

Null:

The null type has just one value – null. It is used for advanced scripting, usually to indicate the absence of any particular value.

Undefined:

The undefined type has just one value – undefined. Any variable or property that has not been initialised has the undefined type.