Countdown timer with action in the end

Recently I discovered the _Delay() hidden formula. With it, now it is possible to make delayed actions.

How it works:
_Delay(actionOrValue, timeoutInMillis) — will perform action or resolve to value after given timeout.

If set up on a button, the button will remain in “loading” state until timeout fires.

You can use this for e.g. Pomodoro docs and alike.

Demo:

3 Likes

This is awesome. You can use _Noop()._Delay(ms) as “sleep” to make the code more elegant.

RunActions(
  ModifyRows([Timer vars], [Fire at], Now() + Seconds([Countdown seconds])),
  _Noop()._Delay([Countdown seconds] * 1000),
  ModifyRows([Timer vars], [Fire at], ""),
  OpenWindow("https://www.youtube.com/watch?v=bjxf-eQWKoo")
)
1 Like

Did you try it? Won’t it execute actions 3 and 4 right away, and only delay the _Noop() by x seconds?

Yep, I’m using it right now. RunActions executes sequentially, so there you have in order: Modify > Delay > (Noop) > Modify > Open

1 Like

Interesting. I tried it with _Delay(some value, [Countdown seconds] * 1000), it modified rows and opened the window without waiting for the delay action to finish.

Thanks for the tip!