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 propertiesglobalThis❌The 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.
Function❌Constructing functions from strings is not allowed. Declare functions normally — see Functions.
Boolean✅Use as a conversion function, Boolean(value).
Symbol❌
Error objectsError✅new Error(message) and throw work. See Error handling.
Error subtypes❌Only the base Error is available. Errors thrown by the runtime are caught as a generic error.
Numbers and datesNumber✅
BigInt❌
Math✅
Date✅For richer date manipulation, Moment.js is also available via the moment function.
Temporal❌Use Date or moment.
Text processingString✅
RegExp✅See Regular expressions below.
Indexed collectionsArray✅Plus 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❌
JSON✅See built-in objects reference.
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.
AsyncIterator❌No generators or asynchronous execution.
Promise❌No generators or asynchronous execution.
GeneratorFunction❌No generators or asynchronous execution.
AsyncGeneratorFunction❌No generators or asynchronous execution.
Generator❌No generators or asynchronous execution.
AsyncGenerator❌No generators or asynchronous execution.
AsyncFunction❌No generators or asynchronous execution.
DisposableStack❌The using statement is not supported.
AsyncDisposableStack❌The using statement is not supported.
ReflectionReflect❌
Proxy❌
InternationalizationIntl and its formatters❌

Statements and declarations​

GroupStatementNotes
Control flowreturn✅
break✅
continue✅
throw✅
if...else✅See Flow control.
switch✅See Flow control.
try...catch✅Including finally. See Error handling.
Declaring variableslet✅See Variables.
const✅See Variables.
var✅Works, but prefer let / const.
using❌
await using❌
Functions and classesfunction✅See Functions.
function*❌No generators or asynchronous execution.
async function❌No generators or asynchronous execution.
async function*❌No generators or asynchronous execution.
class❌Use 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...of❌No asynchronous execution.
OthersEmpty✅
Block✅
Expression statement✅
label✅
import❌Code is organized in Libraries, no need to import or export.
export❌Code is organized in Libraries, no need to import or export.
debugger❌
with❌Deprecated 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 function❌No asynchronous execution.
Left-hand-sideProperty accessors✅a.b and a['b'].
?.✅
new✅Only for whitelisted constructors (Date, Map, Set, RegExp, Error, …).
new.target❌
super❌
import.meta❌
import()❌
Increment / decrementA++✅
A--✅
++A✅
--A✅
Unarytypeof✅
delete✅
void✅
!✅
~✅
unary +✅
unary -✅
await❌No 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✅
Yieldyield❌No generators.
yield*❌No generators.
Spread...obj✅
Comma,✅

Functions​

FeatureNotes
Arrow functions✅
Default parameters✅
Rest parameters✅
arguments object❌Use rest parameters (...args) instead.
Method definitions✅
getter / setter❌Accessor 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 grammar✅Comments, 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 features❌Deprecated globals such as escape() / unescape() are not available.
TypeScript syntax❌AutomatorScript 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.