What is Clockwork and how do I use it?


Clockwork is a new feature of Helm that let’s you set up timed events. It’s like having a super-reliable operator pressing the buttons for you. This short guide takes you through the process of setting up a panel to use Clockwork.

Let’s start with a simple router control panel

media_1381144224532.png

Only two components:

1 – a 16 x 16 router

2 – a router bus control

Now let’s see how we can make this switch automatically.

We add two new components from the Parts Bin

media_1381144497141.png

We drag a Clockwork engine onto the panel,

and a Clockwork Manager View.

Now let’s see how we set these up.

First link the Clockwork Manager with the engine

media_1381144716375.png

Click on the Engine property and select the Clockwork engine.
(As you can see, you can have more than one manager and more than one engine…)

Now we’ll set up the Engine itself

media_1381144873975.png

Select the Clockwork Engine, and click on the Event Types property. This opens a dialog that let’s us define the types of events to be executed by Clockwork.

Setting up Event Types

media_1381145181211.png

First click the Add button (1) to create a new event and name the event in the Name text box (2). Then click Edit… (3) to create the event script. The familiar Helm Script Editor window opens.

Editing event scripts

media_1381145359531.png

Editing Clockwork events is exactly the same as editing any other Helm script. Here we’ve created a simple TakeRoute command just to demonstrate Clockwork, but scripts can be as complex or as simple as you require.

The completed Event

media_1381145575893.png

Now it has a script the event is ready to use.

To make events easier to see in the manager list you can colour the text (1) and the background (2). You can also use parameters in events and we’ll come back to that in another article. For now let’s run up the panel and see how this works.

Run the panel.

media_1381146337159.png

When we open the panel there are no events in the Clockwork Manager. To add an event we right-click in the Clockwork Manager and select the event to add.

Setting up the event time

media_1381147147246.png

To schedule an event the minimum information needed is the time (1) and date (2) when it will occur.

You can also create repeating events (3) the choices are:

  1. One-Time
  2. Daily
  3. Monday
  4. Tuesday
  5. Wednesday
  6. Thursday
  7. Friday
  8. Saturday
  9. Sunday
  10. Weekdays
  11. Weekends

Here we’ll create a One-Time event to happen at 3:00 PM today.

media_1381147193372.png

Now the event is entered in the list and the Next Due time and date are displayed.

3:00 PM comes around and…

media_1381147320066.png

The router switches to In 2, and the Next Due field goes blank showing that the event has happened and no repetition is programmed.

Tagged with: ,
Posted in Scripting