Hamster-Scripts: Functions (built-in)



Clears all scheduler entries.

Returns: 0

# see example under AtAdd

AtAdd( <subname>, <from>, <til>, <wdays>, <repeat>, <immediate> )

AtAdd( <subname>, <from> )

Adds a new scheduler entry.

<subname> gives the name of a user-defined "sub", which is startet when the entry is triggered by "AtExecute".

<from> and <til> contain the time-period, in which the entry is triggered (default for <til> is <from>; format for both is "HH.MM").

<wdays> is a string which contains a marker for each day of the week for which the entry is valid ("1"=valid; first char=Monday, ..., seventh char=Sunday; default="1111111").

If <rep> contains a value greater than 0, the entry is triggered every <repeat> minutes.

The parameter <immediate> became obsolete, it is ignored.

Returns: 0 on success, -1 if a sub with given <subname> does not exist

AtAdd( getmails, "00:00", "06:00", "1111100", 60)
AtAdd( getmails, "06:00", "18:00", "1111100", 15 )
AtAdd( getmails, "18:00", "24:00", "1111100", 60 )
AtAdd( getmails, "12:00", "",      "0000011" )
AtAdd( getnews,  "03:15" )
AtAdd( getnews,  "18:45" )

sub getmails
   # ...

sub getnews
   # ...

AtExecute( <timeout> )


Waits until one of the scheduler-entries added by "AtAdd" is triggered, executes its accompanying sub-function and if this function returns 0, it continues to wait for the next entry to come.

<timeout> gives the maximum time in milliseconds (1/1000 seconds), AtExecute should wait for the next entry.

Returns: -1=timeout, >0: return-value of last executed sub.

# see example under AtAdd

[www.elbiah.de Hamster Playground Documentation]