Using Action limiters in action files

Lets say you have an action file, and you want to output a template each time an update happens but you also want to perform another template only every 5 minutes (perhaps to add to a CSV file).

If you want to use this new function, you will want to action file to execute every time rather than limiting the execution with the On Updates Seconds option. If the On Updates Seconds is used, the results will probably be unpredictable. So just disable the On Update Seconds if you are going to use this new feature. Don’t forget this advice!

WS-23XX Wireless mode

If you are running wirelessly, you must force the wired mode update rate as wireless updates may exceed a full minute. If the time between updates exceeds one minute, the results will be unpredictable. To force WUHU poll to console more frequently even though you are using wireless mode you need to add the WS23xx Force Wired Mode Update Rate to the configuration INI file.

You can precede any action or template with the new time(): macro.

The simple form of the time macro is:

 

time(START_HOUR:START_MINUTES, END_HOUR:END_MINUTES):

 

At a minimum, the start and end times (24 hour clock times) must be specified. This defines the range of time that the action is allow to execute. If the current time (PC clock time) is outside of the range, the action will not execute.

For example, lets say you have a template that you want to be active only between 12:00 and 16:00. You would preceed the template line with:

 

time(12:00,16:00):template:"C:\TEMP\INTEMP.TXT" "C:\TEMP\OUTTEMP.TXT"

 

This will allow the template to only run between 12:00 and 16:00. This template would execute every time there is an update from the console.

There are optional parameters that can be specified as well. If optional parameters are specified, the macro will run at most once per minute. Hopefully the reason will be clear after a few examples.

Lets say you want the macro to run from 00:00 to 23:59 but you only want it to run on the 5s (0, 5, 10, 15, etc).

 

time(00:00,23:59,@5 ):template:"C:\TEMP\INTEMP.TXT" "C:\TEMP\OUTTEMP.TXT"

 

The template will then be processed every 5 minutes from 00:00 to 23:39.

You can specify specific minutes past the hour:

 

time(00:00,23:59,12,25,32,45 ):template:"C:\TEMP\INTEMP.TXT" "C:\TEMP\OUTTEMP.TXT"

 

This will cause the template to be processed only 4 times at 12, 25, 32, and 45 minutes past the hour, between the hours of 00:00 and 23:59. Remember, the template will be processed only one time for each offset past the hour.

If you only want the action to execute at the top of every hour:

 

time(00:00,23:59,0):template:"C:\TEMP\INTEMP.TXT" "C:\TEMP\OUTTEMP.TXT"

 

You also can specify a range of minutes.

 

time(00:00,23:59,10-15):template:"C:\TEMP\INTEMP.TXT" "C:\TEMP\OUTTEMP.TXT"

 

This would allow the template to execute once per minute from 10 minutes past the hour to 15 minutes past the hour (a total of 5 times), between the hours of 00:00 and 23:59.

You can mix and match any of the above optional parameters.

 

time(00:00,23:59,@10,  15,  17,  25 - 30,  50 - 55):template:"C:\TEMP\INTEMP.TXT" "C:\TEMP\OUTTEMP.TXT"

 

This would execute the template one time every ten minutes from the top of the hour, once at 17 minutes past the hour, once each minute from 25 to 30 (5 times) and at 50 to 55 minutes (another 5 times) from 00:00 to 23:59. I cannot imagine why you would want to do that, but the capability is there.

The time(): limiter should be allowed before any action, including program executions:

 

time(00:00,23:59,@10):silent:ftp.exe "-n -s:c:\Heavyweather\FTPScript.txt"

 

Would silently execute the ftp program every 10 minutes from 00:00 to 23:59.

You do not need to limit every action in the file. For example:

 

template:"C:\TEMP\INTEMP.TXT" "C:\TEMP\OUTTEMP.TXT"
time(00:00,23:59,@10):silent:ftp.exe "-n -s:c:\Heavyweather\FTPScript.txt"

 

Would process the template each time, but subjects the ftp execute to the time limit.

In order to get it to run at 5 minutes after the hour, every 3 hours, would this work:

 

time(00:00, 00:00, 5):<some.exe>
time(03:00, 03:00, 5):<some.exe>
time(06:00, 06:00, 5):<some.exe>
time(09:00, 09:00, 5):<some.exe>
time(12:00, 12:00, 5):<some.exe>
time(15:00, 15:00, 5):<some.exe>
time(18:00, 18:00, 5):<some.exe>
time(21:00, 21:00, 5):<some.exe>

 

If you have any problems, please post your action file to our email group, log entry’s (if there are any related log entries), and a description of the problem you are encountering.

LEAVE A COMMENT