Automate support the following value types:
Null is a special keyword denoting a undefined/missing value.
Numbers are stored internally as double-precision 64-bit IEEE 754 floating point values. See Arithmetic operators.
Numbers can be represented in expressions with following literals:
123.45
0xCAFEBABE
0b00110011
Text, or string, is a sequence of characters.
A text literal is zero or more characters enclosed in double quotation marks; "Hello world"
.
In addition to ordinary characters, you can also include special characters within text literals:
Character | Description |
---|---|
{expression} | String interpolation, see below. |
\b | Backspace |
\f | Form feed |
\n | New line |
\r | Carriage return |
\t | Tab |
\' | Single quote/Apostrophe |
\" | Double quote |
\\ | Backslash |
\{ | Avoid interpretation of left curly-bracket as start of a string interpolation |
\uXXXX | The Unicode character specified by the four hexadecimal digits XXXX. For example, \u00A9 is the Unicode sequence for the copyright symbol. |
String interpolation is a way to construct a text value that include expressions which are evaluated at run-time.
Each “interpolation” inside a text literal is wrapped in curly brackets; "1 times 3 is {1*3}"
.
To format the inserted value add a function name after the expression;
"1 times 3 is {1*3;numberFormat}"
.
Any additional arguments are passed to the function as text;
"Today is {now;dateFormat;MMM dd}
.
An array is a container object that holds a dynamic number of values of any type. Each item in an array is called an element, and are accessed by its numerical integer index. The index is zero-based, first element has index 0, last element has index length - 1. A negative index will access the array from the end (length + index).
To access an array use the subscript operator, length operator and for each block. To modify an array use the array add block, array remove block and array set block.
An array literal is a list of zero or more expressions, each of which represents an array element, enclosed in square brackets [ ]:
[ 1, "two", 3.0, null, dict ]
A dictionary is a container composed of key-value pairs called entries, such that each possible key appears at most once in the collection. A dictionary only allows text keys, any other type including null will be converted to text. The value may be of any type.
Each entry can also have an associated conversion type, used when communicating with apps supporting other value types.
To access a dictionary use the subscript operator, length operator and for each block. To modify a dictionary use the dictionary put block and dictionary remove block.
A dictionary literal is a list of zero or more entries with or without conversion type, enclosed in curly brackets { }:
{ "a":1, "b" as Int: 3.333, "c" as Uri: "http://llamalab.com" }
Automate only support four value types; number, text, array and dictionary. Other apps, including the Android operating system itself, supports a different set of value types. So when sending a dictionary to another app some entry values may need conversion.
To specify what a value should be converted to, the “as” keyword followed by the type can be inserted after the key;
"link" as Uri: "http://llamalab.com"
. The following conversion types are allowed: