12.4.36    SLEEP

Description:   Not recommended.  This will stop the client from processing any commands or functions. It suspends Scripts and Task space processing for specified seconds. Trends will not update, etc.

Syntax:

Tcl:              SLEEP seconds

JScript:         SLEEP("seconds");

VB Script:      SLEEP "seconds"

                                     

Arguments:    seconds

Returns:        none

See Also:       after, if, while

 

Examples:      #example 1 - sets text70 equal to 10

set time1 [clock seconds]

SLEEP 10

set time2 [clock seconds]

set deltat [expr "$time2 - $time1"]

SETVAL text70=$deltat

Don't use this command unless you thoroughly understand it.  It suspends processing the current script, and all processes in current task space (i.e. window) for specified number of seconds.  Trends won't update and displays will freeze if called from a local script.

It is usually better to use an IF or While loop instead of SLEEP.

For a Local Script (e.g. a graphic Display), during SLEEP, no pushbuttons or display updates happen. 

For a Global Script, SLEEP will block the script and in turn delay other scripts. This is because all Global Scripts on the same SCADA node run sequentially inside bwscrp.exe.