actiona icon indicating copy to clipboard operation
actiona copied to clipboard

Feature: Timeout and blocking in scripts

Open Termplexed opened this issue 4 years ago • 0 comments

Timeout

If possible, it would be nice to have timeout for MessageBox.

One can use showModal() for it to block, but there is no option to set a timeout.

A typical scenario is having an automated task that runs periodically. As it takes over the mouse and write text one ask user if it can take borrow these for a little while.

Now: If user is away from computer or doing something else that does not require these peripherals - the message box times out and the script proceeds with its task.

This gives

  1. A warning
  2. A possibility to abort

But at the same time let it run unattended.

I tried to use .show() followed by Execution.sleep() , but the main thread is not updated, and the box content is not even rendered. Tried putting sleep in a loop, but that did not help.

Non-blocking timer

As sleep() is blocking it would be nice to have a non-blocking option. Something like setTimeout in window objects (DOM) where one can set a callback function to resume execution – but, which at the same time, run and update any interactions like clicking a message-box.

Guess those two are somewhat intermingled.

Blocking

Objects like playlist -> play(). That one is non-blocking, but would be nice to have possibility to run it as blocking. One can use Process and hook on onFinished I guess, but then one makes it system dependent (which player to use etc.).

Termplexed avatar Feb 11 '21 06:02 Termplexed