Force timer to execute by script

Can we force a timer execution by scripting ?
like the button.doClick()
timer.do???

In the window that your timer is in, you can set the “running” property in the timer component to true, or 1. Do something like event.source.parent.getComponent(‘Timer’).running = 1. To stop the timer, set the running property back to 0.

I would like on particiular case to trigger the timer which is running without waiting for the next cycle time.

What I would do is…

Create a Boolean memory tag named something like TimedToggle.
Create a Boolean memory tag named something like ForceRun.

Create a Timer script that runs at the rate at which you need your timed operation to occur. In that timer script, toggle your TimedToggle tag true as the timer times out.

system.tag.write('TimedToggle', 1)

Create a Tag Change script that will execute whatever you need done at a timed rate, but can be forced to run at any time by the ForceRun tag as shown below. For this example, I am incrementing an integer memory tag named MyValue every time the timer trips or the ForceRun tag is set to true.

[code]qv = system.tag.read(‘TimedToggle’)
timedToggle = qv.value
qv = system.tag.read(‘ForceRun’)
forceRun = qv.value

if either tag is true, increment MyValue and reset both tags to false

if forceRun == 1 or timedToggle == 1:
qv = system.tag.read(‘MyValue’)
myValue = qv.value + 1
system.tag.write(‘MyValue’, myValue)
system.tag.write(‘TimedToggle’, 0)
system.tag.write(‘ForceRun’, 0)
[/code]

I hoped a method on the timer script object to directly trigger it
without additionnal tagchange scripts and tags !
I will post a feature request !

Thanks for your solution, it enable to wait for this feature.