TimerActions Demo

Look at me!!

Timers to trigger actionwidgets.

$:/plugins/OokTech/TimerActions

0.0.1

What does it do?

You create scripts made up of action widgets and then the plugin runs the scripts at specific times.

Options include:

  • Periodic (Run every n minutes/seconds/hours/days)
  • Run once after some interval (run once after 10 minutes have passed)

You can open the Manage Timers tab in $:/plugins/OokTech/TimerActions to start, stop or edit existing timers and the New Timer tab to create new timers.

How to use it

Open the New Timer tab. Using the from there give the timer a name (the name becomes a tiddler title so the same restrictions apply). Select the timer type (periodic or countdown), give a period for the timer and finally set the action widget that make the script.

After defining the script (or scripts) open the Manage Timers tab. The select timer input can be used to select a specific timer, or you can pick show all and then find the timer in the list. Click the start button next to the name of the timer you want to start.

Limits

This runs in the browser, so the actions only happen if the wiki is open in the browser.

The accuracy of the timer is limited. It is possible to make it accurate to the millisecond, but that could be very processor intensive because the process has to check if there is a task to run every millisecond. The default is to check every second, so at most the task could be delayed by one second. If you don't require precision than it may be a good idea to make that even longer and switch to 5 or 10 seconds.

Internals

Each scheduled action has a tiddler that defines it. The tiddler text should contain the action widget script to execute. It uses the same thing as the startup actions, so anything that works there should work here too.

  • timer_type can be periodic or countdown
  • period if the timer_type is periodic this is the period, if it is countdown than this is the length of the countdown.
  • start the timestamp for when the countdown/period starts for periodic and

countdown types.

For The Future™

  • Add another timer type that runs at a specific date/time.
  • Add another timer type that runs periodically based off of calendar events

(like every monday, or every day at 10am, etc.)

17th October 2018 at 1:49pm

The way that the timers are implemented is flexible but it isn't precise. If you need a timer that has less than one second precision than this isn't the appropriate tool.

The timer is updated periodically, you can change the update period in the Configuration tab in the plugin tiddler below.

The update period and the timer period can lead to some unexpected things. If you start the Demo Timer under the Manage Timers tab than you can see that the site subtitle only updates every two seconds despite the period being set to one second. This is expected.

You can get around this problem by only having timers that have periods that are longer than the update interval.