Default Data Types

Text

A text variable, can be set when using the set assignment statemet followed by a string. A text variable value should be always in quotes.

Setting a string- text value

set textvar to 'Hello World'
textvar is a text variable.

Using three quotes in a text variable can be used to declare a multiple line text variable.

set textvar to '''This can be used 
to set a 
multiline text.'''

Text data type properties

  • .Length (Numeric): the length (in characters) of the text stored into the variable.

Numeric

Numeric variable values can be set using a number in the command.

set num to 6

Setting a decimal numeric value should always have a dot as the decimal point.

set num to 6.3
Setting a hexadecimal value
set hexnum to 0x0000
Setting a octadecimal value
set octnum to 0o0000

Boolean

A Boolean variable can be set using the comparison operators

set boolvar to 3!=3
Another way to set a boolean variable is using the logical operators.
set boolvar to 3=4 or 10>1

In this case despite 3 is not equal to 4, the boolvar variable would be true as the second condition is valid.

Alternatively, a boolean variable can be set using the words true or yes and false or no.
set boolvar to True
set boolvar to no
A boolean variable can only have a True or False value.

Comparison Operators

The comparison operators used are the following.

Notation Operation
= Equal
!= Not equal
<> Not equal
< Less
<= Less than or equal
> More
>= More than or equal
in Is included
not in Is not included

Logical Operators

Notation Operation
OR When one of many conditions meet
AND When all conditions meet
NOT When a condition does not meet

Examples

set boolvar1 to True
set boolvar2 to no
set boolvar3 to 'a' not in 'abcd'
In the above examples, boolvar1 is true, while boolvar2 and boolvar3 are false.

DateTime

A DateTime variable can be set by a date-time related action such as the “DateTime.Current” which retrieves the current date and time.

Alternatively, a datetime variable can be set by using the following format: d”yyyy-MM-dd HH:mm:ss.fff+zz” where y is the year, M is the month, d the day, H the hours, m the minutes, s the seconds, f the miliseconds and zzz the offset from UTC.

All date fields of a datetime variable are mandatory. The time fields are optional. If a time field is populated, the higher fields are required as well.

set dtvar to d"2019-07-16 14:30:00.000+00"

The value of the dtvar corresponds to the 14.30 UTC on the 15th of July 2019.

The accepted notations appear in the table below:

DateTime Field Notation Digits Mandatory
Year yyyy 4 Yes
Month MM 1-2 Yes
Day dd 1-2 Yes
Hour HH 1-2 No
Minutes mm 1-2 No
Seconds ss 1-2 No
Miliseconds fff 1-3 No
UTC Offset zzz 1-3 No

In regard to the separators, date can be separated using a slash, a dash or a dot (/, -, .) while the time can be separated using a colon (:).

A DateTime variable can also be set by a date-time related action such as the “DateTime.Current” which retrieves the current date and time.

DateTime.Current DateTimeFormat:DateTimeFormat.DateAndTime Offset:'0' CurrentDateTime=> CurrentDateTime

DateTime data type properties

  • .Year (Numeric): The year part of the DateTime value.
  • .Month (Numeric): The month part of the DateTime value.
  • .Day (Numeric): The day part of the DateTime value.
  • .DayOfWeek (Text): The name of the day (e.g. Sunday, Monday etc)
  • .DayOfYear (Numeric): The day of the year part of the DateTime value (1-365 or 366 for leap years)
  • .Hour (Numeric): The hour part of the DateTime value.
  • .Minute (Numeric): The minute part of the DateTime value.
  • .Second (Numeric): The seconds part of the DateTime value.

List

A list of values is considered as a list data type. If the list consists of the same type items, then the list is considered as of that type. (i.e. List of text values) If the list consists of more than one items, then it’s a list of general values.

To form a list, use square brackets. This is a list of numeric values.

set numericlist to [1,2,3,4]
Similarly, this is a list of text values

set textlist to ["Hello","World","This","is","a","list"]

Below, the two lists are combined forming a list of general values.

set GeneralList to ["Hello","World","This","is","a","list",1,2,3,4]
Note, that nested lists can be formed using curly brackets which have each row enclosed. For example the below list displays
set nestlist to [["London","New York","Tokyo"],[1,2,3]]

List data type properties

  • .Count (Numeric): The number of items within the list.

Data Table

A data-table can be formed using curly brackets which have each row enclosed. For example the below data table displays users names and their age.

set dtvar to {['John', 24], ['Catherine', 27], ['Mary', 35] }
This will result to the below.

John 24
Catherine 27
Mary 35

Using a caret, the headers of the data table can be included as well. The header values need to be set in the first row.

set dtvar to {^['Name','Age'],['John', 24], ['Catherine', 27], ['Mary', 35] }

Now the data table looks like this.

Name Age
John 24
Catherine 27
Mary 35

Note, that the below syntax can be used to form an empty data table.

set x to {}

Despite the fact that the Data Table type does not have an actual property to extract, note that the number of rows and columns can be extracted using the .rows.count and .columns.count respectively.

Data Row

One of the default data types is the data table row. To assign a value to a data row variable, a data table is required. Using the above example, the first row will be set as the value of a data row.

set drvar to dtvar[0]

Robin is zero based and the order of data rows always starts from 0.

Custom Object

A custom object is a data type that can be used in order to include custom properties for values.

In this example a custom object is used for a country. The attributes used are the name, capital, population and the country code.

set CustObjectVar to { 'Country': 'France', 'Capital': 'Paris', 'Population': 66998000,'ISO 3166 code': 'FR' }

Note, that the below syntax can be used to form an empty custom object.

set x to {{}}

General Value

A variable having multiple value types will be considered as a general value.

In the example below the variable “genvar” is a general value as it’s used in two different methods through the automation.

During the execution of the first command, genvar will be a number. After the execution of the second command, it will be considered as a text variable.

set genvar to 10
set genvar to 'robin'

File Object

A file object is an object related to a file and it’s value is the path to the file. A file can be found using the GetFiles action which is included in the “Folders Module”.

Folder.GetFiles Folder:  FileFilter:'*'  Files=> Files
set foldervar to Files[0]

Any path stored in a text variable can be used in actions which require a filepath. There is no need to convert the filepath to a File Object prior to using the action.

File Object data type properties

  • .CreationTime (DateTime): The date when the file was created.
  • .Directory (Folder): The directory where the file is stored.
  • .Exists (Boolean): This property is true if the file exists or false if the file does not exist.
  • .Extension (Text): The extension of the file.
  • .FullName (Text): The full path to the file.
  • .IsArchive (Boolean): This property is true if the file is an archive or false if it is not.
  • .IsEmpty (Boolean): This property is true if the file is empty or false if it is not.
  • .IsHidden (Boolean): This property is true if the file is hidden or false if the file is visible.
  • .IsReadOnly (Boolean): This property is true if the file is read only or false if it is not.
  • .IsSystem (Boolean): This property is true if the file is a system file or false if it is not.
  • .LastAccessed (DateTime): The date when the file was last accessed.
  • .LastModified (DateTime): The date when the file was last modified.
  • .Name (Text): The name of the file, including the extension (e.g. MyFile.txt).
  • .NameWithoutExtension (Text): The name of the file, without its extension.
  • .RootPath (Folder): The root path of the file (e.g. C:).
  • .Size (Numeric): The size of the file (in bytes).

Folder Object

A folder object is an object related to a folder and it’s value is the path to the folder. A folder can be found using the GetSubFolders action which is included in the “Folders Module”.

Folder.GetSubfolders Folder: 'C:\Users'  FolderFilter:'*' IncludeSubfolders:False  Subfolders=> Subfolders
set foldervar to Subfolders[0]

Folder Object data type properties

  • .CreationTime (DateTime): The date when the folder was created.
  • .Exists (Boolean): This property is true if the folder exists or false if the folder does not exist.
  • .FilesCount (Numeric): The number of files included in this folder.
  • .FoldersCount (Numeric): The number of folders included in this folder.
  • .FullName (Text): The full path to the folder.
  • .IsEmpty (Boolean): This property is true if the folder is empty or false if it is not.
  • .IsHidden (Boolean): This property is true if the folder is hidden or false if the file is visible.
  • .LastModified (DateTime): The date when the folder was last modified.
  • .Name (Text): The name of the folder.
  • .Parent (Folder): The parent directory of the folder.
  • .RootPath (Folder): The root path of the folder (e.g. C:).