Hi Guillaume,
Here is a panel with a toggle parameter, and a timer that counts down from 10s. When it hits 5 seconds, it prints out something on the console, if the parameter is toggled on.
<abs contexttype="opengear" gridsize="20" id="_top" keepalive="false" style="">
<timer autostart="false" id="Countdown" pattern="HH:mm:ss" rate="1000" start="00:00:10" stop="00:00:00">
<timertask tasktype="ogparamset">params.setValue('time', 0, event.getDisplay());</timertask>
<timertask tasktype="timercontrol">timer = ogscript.getTimerManager().getTimer('Countdown');
if (timer.getCurrent() == 5000 && params.getValue("toggle",0) == 1) {
ogscript.debug("SOMETHING HAPPENED AT 5 SECONDS");
}
</timertask>
</timer>
<meta>
<params>
<param access="1" constrainttype="INT_CHOICE" name="Toggle" oid="toggle" precision="0" type="INT16" value="1" widget="toggle">
<constraint key="0">Do Not Do Action</constraint>
<constraint key="1">Do Action at 5s</constraint>
</param>
<param access="1" maxlength="0" name="time" oid="time" type="STRING" value="00:00:07" widget="label"/>
</params>
</meta>
<param expand="true" height="60" left="80" oid="toggle" showlabel="false" top="100" width="200"/>
<param expand="true" height="60" left="300" oid="time" style="style:timerLabel" top="100" width="260"/>
<button buttontype="push" height="60" left="580" name="GO" top="100" width="120">
<task tasktype="timercontrol">ogscript.getTimerManager().getTimer('Countdown').startTimer(true);</task>
</button>
</abs>
Let me know if you have further questions.
#DashBoard