Automate

Automate

Make your phone or tablet smarter with automation

Get it on Google Play

Values

Automate support the following value types:

Null

Null is a special keyword denoting a undefined/missing value.

Number

Numbers are stored internally as double-precision 64-bit IEEE 754 floating point values. See Arithmetic operators.

Number literal

Numbers can be represented in expressions with following literals:

  • decimal number (base-10) with or without a fractional part and exponent; 123.45
  • hexadecimal (base-16) using the 0x prefix; 0xCAFEBABE
  • binary number (base-2) using the 0b prefix; 0b00110011

Text

Text, or string, is a sequence of characters.

Text literal

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:

CharacterDescription
{expression}String interpolation, see below.
\bBackspace
\fForm feed
\nNew line
\rCarriage return
\tTab
\'Single quote/Apostrophe
\"Double quote
\\Backslash
\{Avoid interpretation of left curly-bracket as start of a string interpolation
\uXXXXThe Unicode character specified by the four hexadecimal digits XXXX. For example, \u00A9 is the Unicode sequence for the copyright symbol.

String interpolation

String interpolation is a way to construct a text value that includes expressions which is evaluated at run-time. Each “interpolation” inside a text literal is wrapped in curly brackets; "1 times 3 is {1*3}". To format of 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}.

Array

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.

Array literal

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 ]

Dictionary

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 directory 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.

Dictionary literal

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" }

Dictionary conversion types

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:

  • Boolean
  • BooleanArray
  • Bundle
  • BundleArray
  • BundleList
  • Byte
  • ByteArray
  • Char
  • CharArray
  • CharSequence
  • CharSequenceArray
  • CharSequenceList
  • ComponentName
  • ComponentNameArray
  • ComponentNameList
  • Double
  • DoubleArray
  • Float
  • FloatArray
  • Int
  • IntArray
  • IntList
  • Intent
  • IntentArray
  • IntentList
  • Long
  • LongArray
  • Short
  • ShortArray
  • String
  • StringArray
  • StringList
  • Uri
  • UriArray
  • UriList
Note! This documentation can also be found in the Help & feedback menu of the app.