11.1.85    <SCRLOOP>@

Description:   Execute a WebAccess script repeatedly (loop).  Downloads the file if it does not exist or a newer version exists on SCADA node.  Script will repeat until SCRSTOP.

Syntax:         <SCRLOOP>@ filename.scr

                             <SCRLOOP>@ filename, frequency, repeats

                             <SCRLOOP>@ filename, frequency, 0

                             <SCRLOOP>@ filename, 0.0, repeats

                             <SCRLOOP>@filename, frequency, repeats</SCRLOOP>,<keymacro>

          

Argument:     file name, path, frequency, repeats
frequency  range (0.025 - 400 seconds) , 0.0  uses  default  script frequency  = 0.5 sec.
repeats = 0 is forever until SCRSTOP

See Also:       </SCRLOOP>, <SCREXEC>, <MCREXEC>

Examples:      #example 1 - repeat forever at default frequency (0.5 seconds)

<SCRLOOP>@playwarning.scr

#example 2 - loop script every 3 seconds until scrstop

<SCRLOOP>@playwarning.scr,3.0,0

#example 2 - loop script every 3 seconds, repeat 20 times

<SCRLOOP>@playwarning.scr,3.0,20

<SCRLOOP> will download the called script file if it does not exist, then enter the script into the program queue for that display to repeat continuously (loop) until the number of repeats is reached or until SCRSTOP command.  If repeats =0 or no repeat specified, script will loop forever or until SCRSTOP. SCRLOOP does not execute immediately.  Instead, it is placed in the program queue, then executed after the script ends.  If the called script is not found on the client, it will be downloaded from the SCADA node. 

The called script will begin to loop after the calling script ends.  Only a <SCRSTOP> command will terminate the looping script if  a number of repeats was not specified.  The keymacro <SCRSTOP> will stop the loop, as well as the SCRSTOP command executed from any script from any display within the calling task (i.e. client window).

Only one script can loop per program space (i.e. per client window or display group task).

If no arguments are specified, then the script will loop at the default script frequency until SCRSTOP.  The default script frequency is 0.5 seconds.

The playwarning.scr script called in example 1 above:

catch {

MCISEND {close all}

}

catch {

MCISEND {open autodest.wav type WaveAudio alias wave wait}

}

MCISEND {play wave from 1}

#countdown

set x [GETVAL analog1]

<SETVAL>analog1=[expr $x - 3]

If the looping script uses local screen tags not found on the new display, changing displays will seemingly stop the script from looping temporarily until you return to the display. (For example if analog1 in the above example is a screen tag, not a constant point). But, upon return to the display, the called script will continue to repeat without additional SCRLOOP commands since the local screen tags will become available to the script.