41 timer
This object executes actions at fixed times in intervals specified before. It is possible, for example, to start a process on a fixed day in the week, or to be reminded of certain dates (days, hours,…).
With the timer times can be specified in months, weeks, days, hours, minutes, and seconds. Intervals can also be defined in these units.
Definition
{ export | reexport } { model } timer { <Identifier> } { <object-specific attributes> }
Events
Children
Parent
Menu
none
41.1 Attributes
Attributes |
RLD |
PID |
Properties |
Short Description |
---|---|---|---|---|
boolean |
boolean |
S,G/D/C |
active state of object |
|
class |
class |
-,G/-/- |
class/id of object |
|
integer |
integer |
S,G/D/- |
repetition of timer |
|
identifier |
instance |
-,G/-/- |
dialog to which the object belongs |
|
object |
document |
S,G/-/- |
accesses the I-th XML Document |
|
boolean |
boolean |
-,G/-/- |
returns if the object class is an USW class |
|
class |
class |
-,G/-/- |
returns the I-th registered USW class |
|
object |
record |
S,G/-/C |
accesses the first record of an object |
|
string |
string |
S,G/D/C |
intervals of timer |
|
string |
string |
S,G/D/C |
name/identifier of object |
|
object |
record |
S,G/-/C |
accesses the last record of an object |
|
identifier |
instance |
S,G/D/C |
model belonging to object |
|
object |
record |
S,G/-/C |
accesses the I-th record of an object |
|
integer |
integer |
-,G/-/- |
queries the number of child records |
|
integer |
scope |
-,G/-/- |
queries the object type (Default, Model or instance) |
|
string |
string |
S,G/D/C |
specified time for timer |
41.1.1 Definition of Time Spans
There are two possibilities for time definition:
- absolute time definition
- relative time definition
{<hour>}:{<minute>}{:{<second>}}
{<day>}.{<month>}.{<year>} {<hour>}:{<minute>}{:{<second>}}
{<month>}/{<day>}/{<year>} {<hour>}:{<minute>}{:{<second>}}
{<DoW>} {<hour>}:{<minute>}{:{<second>}}
DoW: day of the week (1 = Monday, 2 = Tuesday, .... , 7 = Sunday)
+ {<hour>}:{<minute>}{:{<second>}}
+ n d
+ n D
+ n m
+ n M
+ n y
+ n Y
d, D: |
days |
m, M: |
months |
y, Y: |
years |
If no value is specified in the absolute time definition, the corresponding value will be taken from real time, i.e. "now".
If no seconds are specified, they will be set to 0 if : is missing, or to the seconds in real time if : is given.
Day numbers up to 31 are allowed for each month. If a month has less days, the last day specified will be considered the last day of that month.
Years can be specified in the range of 1901 to 2099. Alternatively, values from 0 to 99 are allowed, which will be mapped to the period 1970 to 2069.
Examples
-
Every Friday at noon
.starttime "5 12:00";
.incrtime "+7D";
-
Every day at 16:00
.starttime "16:00";
.incrtime "+1D";
-
Christmas Eve 19:00
.starttime "24.12 19:00";
.incrtime "+1Y";
-
Four hours after program start
.starttime "+04:00";
Note
The attribute .starttime can be used for the absolute time definition or for the time interval.
The attribute .incrtime can be used for the time interval only.
41.2 Example
Use of a timer for an autosave function:
timer TiAutoSave { } window WnAutoSave { child checkbox CbAutoSave { } !! Timer is activated and deactivated with this checkbox. child edittext EtMin { } !! Includes the number of minutes after which the !! select event for the timer is to be sent. child edittext EtFileName { } !! Name of the file in which is to be stored. } on CbAutoSave select { if CbAutoSave.active then CbAutoSave.text := "yes"; TiAutoSave.incrtime := (("+:" + EtMin.content) + ":"); TiAutoSave.active := true; else CbAutoSave.text := "no"; TiAutoSave.active := false; endif } on TiAutoSave select { !! Rule R_SaveFile(EtFileName.content) is called at each !! select event. }