Skip to main content

Relation to JavaScript

As mentioned, AutomatorScript is a subset of JavaScript. The syntax is the same and many built-in objects and methods are available. This page starts with a short summary of the features that are available and the ones that are not, followed by a complete reference.

Supported language features

All modern, everyday JavaScript syntax is supported. This includes:

  • Variables, covered in Variables.
  • Operators and expressions for arithmetic, comparison, and assignment, including optional chaining (?.), nullish coalescing (??) and more.
  • Flow control with return, if-else, loops, and so on, covered in Flow control.
  • Functions - both named, anonymous, arrow functions, IIFEs, and so on, covered in Functions.
  • Error handling with throw, try, catch, and finally as covered in Error handling.
  • Destructuring - object, array, nested, with rest and defaults, in assignments, function parameters, and loops.
  • Spread syntax (...) for arrays and objects.
  • Template literals such as `Hello ${name}`.

Built-in objects and functions

The native types Array, String, Number, Boolean, Date, Math, RegExp, Map, Set, and Error are fully supported, along with all their functions.

The Object type is partially supported: everyday functions such as Object.keys and Object.assign are available, but functions used for meta-programming are not, and you cannot access the prototype property of any object.

For easy date manipulation, Moment.js is also available via the moment function.

The full list of built-in functions is documented in the Built-in objects reference.

Unsupported language features

The following JavaScript features are not available. Using them will result in an error:

  • Classes.
  • Modules and the import and export keywords. Instead, code is organized in libraries.
  • TypeScript syntax - type annotations, interfaces, and so on. To annotate types, use JSDoc comments instead.
  • eval().
  • Sparse arrays such as [1, , 3].
  • async / await, promises, and generators. AutomatorScript abstracts away asynchronous execution, as explained here.

Reference

This section contains a complete and systematic overview of the language features that are available in AutomatorScript. The tables below closely follow the MDN JavaScript reference, so you can look up any feature there and check its status here.

Legend: ✅ supported · ❌ not available · ⚠️ partially supported, see the note.

Standard built-in objects

In addition to the below table, refer to the built-in objects reference for the supported functions of each supported object type.

GroupObjectNotes
Value propertiesglobalThisThe automator exposes no global object.
Infinity
NaN
undefined
Function propertieseval()Executing code from a string is not allowed in the automator.
isFinite()
isNaN()
parseFloat()
parseInt()
encodeURI()
encodeURIComponent()
decodeURI()
decodeURIComponent()
escape()Deprecated in JavaScript, not supported in AutomatorScript.
unescape()Deprecated in JavaScript, not supported in AutomatorScript.
Fundamental objectsObject⚠️Object literals and the data methods Object.keys, Object.values, Object.entries, Object.fromEntries, and Object.assign are available. Meta-programming methods (defineProperty, getPrototypeOf, freeze, …) are not.
FunctionConstructing functions from strings is not allowed. Declare functions normally — see Functions.
BooleanUse as a conversion function, Boolean(value).
Symbol
Error objectsErrornew Error(message) and throw work. See Error handling.
Error subtypesOnly the base Error is available. Errors thrown by the runtime are caught as a generic error.
Numbers and datesNumber
BigInt
Math
DateFor richer date manipulation, Moment.js is also available via the moment function.
TemporalUse Date or moment.
Text processingString
RegExpSee Regular expressions below.
Indexed collectionsArrayPlus the extra array extension methods. Sparse arrays are not supported.
Int8Array and the other typed arrays
Keyed collectionsMap
Set
WeakMap
WeakSet
Structured dataBuffer⚠️Create buffers with Buffer.from. See built-in objects reference.
ArrayBuffer
SharedArrayBuffer
DataView
Atomics
JSONUse the built-in parse() and stringify() functions instead.
Managing memoryWeakRef
FinalizationRegistry
Control abstractionIterator⚠️The iterators returned by Map/Set/Array methods such as .entries() and .values() can be consumed (for example with for…of). The Iterator global and its helper methods are not available.
AsyncIteratorNo generators or asynchronous execution.
PromiseNo generators or asynchronous execution.
GeneratorFunctionNo generators or asynchronous execution.
AsyncGeneratorFunctionNo generators or asynchronous execution.
GeneratorNo generators or asynchronous execution.
AsyncGeneratorNo generators or asynchronous execution.
AsyncFunctionNo generators or asynchronous execution.
DisposableStackThe using statement is not supported.
AsyncDisposableStackThe using statement is not supported.
ReflectionReflect
Proxy
InternationalizationIntl and its formatters

Statements and declarations

GroupStatementNotes
Control flowreturn
break
continue
throw
if...elseSee Flow control.
switchSee Flow control.
try...catchIncluding finally. See Error handling.
Declaring variablesletSee Variables.
constSee Variables.
varWorks, but prefer let / const.
using
await using
Functions and classesfunctionSee Functions.
function*No generators or asynchronous execution.
async functionNo generators or asynchronous execution.
async function*No generators or asynchronous execution.
classUse functions and plain objects instead.
Iterationsfor
for...of
while
do...while
for...in⚠️In AutomatorScript, this behaves the same as for...of.
Do not use.
for await...ofNo asynchronous execution.
OthersEmpty
Block
Expression statement
label
importCode is organized in Libraries, no need to import or export.
exportCode is organized in Libraries, no need to import or export.
debugger
withDeprecated in JavaScript, not supported in AutomatorScript.

Expressions and operators

GroupOperatorNotes
Primary expressionsthis⚠️Resolves, but is rarely useful; there are no classes and no method binding.
Literals
[ ]
{ }
( )
function
/ab+c/i
`string`
tag`string`
class
function*No generators.
async functionNo asynchronous execution.
Left-hand-sideProperty accessorsa.b and a['b'].
?.
newOnly for whitelisted constructors (Date, Map, Set, RegExp, Error, …).
new.target
super
import.meta
import()
Increment / decrementA++
A--
++A
--A
Unarytypeof
delete
void
!
~
unary +
unary -
awaitNo asynchronous execution.
Arithmetic+
-
*
/
%
**
Relational<
>
<=
>=
instanceof
in
Equality==
!=
===
!==
Bitwise shift<<
>>
>>>
Binary bitwise&
|
^
Binary logical&&
||
??
Conditional (ternary)condition ? a : b
Assignment=
*=
/=
%=
+=
-=
<<=
>>=
>>>=
&=
^=
|=
**=
&&=
||=
??=
[a, b] = arr, { a, b } = obj
YieldyieldNo generators.
yield*No generators.
Spread...obj
Comma,

Functions

FeatureNotes
Arrow functions
Default parameters
Rest parameters
arguments objectUse rest parameters (...args) instead.
Method definitions
getter / setterAccessor properties are not supported.

Classes

Classes are not supported. There is no class keyword, and therefore no constructor, extends, private elements, public class fields, static members, or static initialization blocks. Model data with plain objects and your behavior with functions.

Regular expressions

Regular expressions are fully supported.

Other

TopicNotes
Lexical grammarComments, literals, and semicolons behave as in standard JavaScript. One addition: identifiers starting with $ are always global — see Variables.
Trailing commas
Data structures⚠️The available types are limited to those listed above.
Iteration protocols⚠️for…of works on the built-in iterables (Array, String, Map, Set). Custom iterables are not possible, as they rely on Symbol.iterator.
Strict mode⚠️The sandbox is always restricted; a "use strict" directive is unnecessary and has no effect.
Deprecated featuresDeprecated globals such as escape() / unescape() are not available.
TypeScript syntaxAutomatorScript is JavaScript, not TypeScript. You cannot use type annotations or interfaces, even though the code editor is TypeScript-aware for code completion. Use JSDoc comments to annotate types.