Browse the docs

scheduled()

The waiting run scheduled with a key, as a record with id, at and in (seconds from now), or null when nothing waits.

Details #

scheduled("save") looks for the run this macro scheduled with the key save (with Run a macro later or a Later block) that is still waiting. It answers a record:

  • id: the pending run's id.

  • at: when it will run, as an ISO date.

  • in: how many seconds from now that is.

When nothing waits under that key it answers null, so scheduled("save") == null reads "nothing is scheduled". A key belongs to the macro that scheduled it; give a second argument to ask about another macro's key: scheduled("standup", "Morning").

In a macro's Only if, which is read before any run exists, a key with no macro named is looked for in every macro.

Outside the engine (the editor's examples), it answers null.

scheduled("save") == null ? "nothing waiting" : "saves in " + scheduled("save").in + " s"
→ nothing waiting

Parameters #

Takes 1 to 2 arguments. {{ scheduled(text, b?) }}

Gotchas #

  • in is counted when the expression is read; it doesn't tick.

  • A run that is starting or has run is no longer waiting, so it answers null.

See also #

Run a macro later, Cancel a scheduled run, Later