Home > Language Reference > System Variables > ScriptAfterTimeout$


The #ScriptAfterTimeout$ system variable specifies the script that will be run when #ExecTimeout has elapsed.


If you need to run a script at regular interval whatever error is reported, #ScriptAfterTimeout$ used in cunjunction with #ExecTimeout allows to rerun within a clean desktop whatever happened during previous execution.




<script_name>, string, constant, name of the script to run after timeout. The .ROB for the specified <script_name> must exist (the .ROB is the compiled script). 


If within the script, #ExecTimeout has been set up and if this timeout elapses during execution, the .rob compiled script specified in #ScriptAfterTimeout$ is launched.

The use of this system variable along with #ExecTimeout allows to recreate a "clean" environment if the script fails for any reason and so you can rerun the same script exactly in the same state than if it was the first time ; see below the example.

If the script name to call contains spaces, you need to surround the script name by CHR$(34):
#ScriptAfterTimeout$=chr$(34)+"After Timeout.rob+chr$(34)

See also



#ScriptAfterTimeout$ = "my_script"   'my_script.rob must exist, if not, an error is reported.

'If a blank is within the full path, surround the string with Chr$(34) as below :
#ScriptAfterTimeout$=Chr$(34)+"c:\wttest\script timeout\display message.rob"+Chr$(34)

'With parameters, the line would be :
#ScriptAfterTimeout$=Chr$(34)+"c:\wttest\script timeout\display message.rob"+Chr$(34)+" param1 param2"

/*This script launches Notepad and the demo page 
After #ExecTimeout seconds (here at 10), the script is killed and the script killprocesses is launched.
This last script kills the two processes Notepad and Iexplore, so the environment before launching the first script is restored.
''Maximum execution time set at 10
'If the timeout is reached, run the killprocesses script
'Some actions, launch notepad, launch a website
StartBrowser("IE", "
UsePage("WinTask Demonstration Pages")
ClickHTMLElement("A[INNERTEXT= 'DOWNLOAD your 30-day']")
'A long pause and so the script takes more than 10 secs to execute  
pause 20

' Script killprocesses-------------------------------------------------
'This other script kills the applications opened by the main one