Skip to content

Script Editor

Scripts are server-side pieces of automation that belong to a project. The Script Editor is where you write them, schedule them, and try them out while developing.

The engine’s rules, its limits and the ins.* API are on the Overview page.

FieldRequiredDescription
NameYesScript name, up to 100 characters. Unique within the project
DescriptionNoDescription, up to 255 characters
CodeYesJavaScript source, up to 65,535 characters
Schedule TypeYesWhen it runs — see the table below
PeriodConditionalFor Periodic, in milliseconds. The smallest value is 100 ms
TimeConditionalFor Daily, the time of day
DelayConditionalFor Once, how long to wait before running
LogYesWhether runs are written to the project log
TypeWhen it runsField it needs
PeriodicContinuously, at PeriodPeriod (≥ 100 ms)
DailyEvery day at the given timeTime
OnceOnce, after DelayDelay
NoneNever on its own — only when run by hand—

If you want a script triggered only from somewhere else (ins.executeScript, an animation click, an alarm hook), leave the type as None.

Saving and scheduling are two separate steps

Section titled “Saving and scheduling are two separate steps”

Saving a script does not make it run. Saving stores the definition; scheduling puts it into the running order. By the same token you do not have to delete a script to stop it — cancelling its schedule is enough.

That separation is what lets you stop a script temporarily without disturbing its definition, which is the ordinary need during maintenance.

Trying a script out while developing and running a saved script by hand are not the same thing, and they return different things.

Running from inside the editorRunning a saved script by hand
Code it runsWhatever is in the editor now — you need not save firstThe saved code
Whose identity it runs asYoursThe space’s automation identity
What it returnsThe script’s return valueA receipt — whether the run happened, and how long it took

The saved run withholding the return value is deliberate: that run executes as the automation identity, which sees the same rows a scheduled run would see. Handing a value it produced back to the person who pressed the button could disclose rows that person cannot see.

In practice: develop and debug with the run inside the editor. When you need to see a value out of a saved run, write it to a variable and read the variable back:

ins.setVariableValue('DEBUG_OUTPUT', { value: computed });

With Log on, the script’s runs and its ins.consoleLog output land in the project log. With it off, console output goes nowhere — turning it on during development is the usual cure for “the script runs but I see nothing”.

Scheduling, cancelling and running by hand can require a signature or an approval, depending on how the installation is configured. Where that applies, the operation is written to the audit trail recording who performed it and on what grounds.