#ExecTimeout
System variable - Program flow management.
The #ExecTimeout system variable specifies the maximum number of seconds that WinTask will wait before killing the current script. Not available in WinTask Lite.
Usage
If you need to run a script at regular interval whatever error is reported, #ExecTimeout used in conjunction with #ScriptAfterTimeout$ allow to rerun within a clean desktop whatever happened during previous execution.
Syntax
#ExecTimeout = n
Remarks
When n seconds have elapsed, if the script is not finished, the script is killed and the execution stopped. If the system variable #ScriptAfterTimeout$ is filled with a value, the script named in this variable is then launched.
The use of this system variable along with #ScriptAfterTimeout$ 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 code.
#ExecTimeout set to 0 means that there is no timeout.
See also
Example
#ExecTimeout = 20
Example code
This script launches Notepad and the Web page www.wintask.com. 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.
#ExecTimeout=10
#ScriptAfterTimeout$="killprocesses"
Shell("notepad")
StartBrowser("IE", "www.wintask.com")
UsePage("WinTask - Automation software and Task Scheduler. Macro software with Macro Recorder")
ClickHTMLElement("A[INNERTEXT= 'WinTask Features']")
UseWindow("IEXPLORE.EXE|ReBarWindow32|WinTask - Features - Microsoft Internet Explorer|1",1)
ChooseItem(ToolBar, "|3", "Back", single, left )
pause 20
' Script killprocesses-------------------------------------------------
KillApp("notepad.exe",1)
killApp("iexplore.exe",1)
This other example shows how to take a screenshot of the desktop after #ExecTimeout.
'If the script does not finish after 30 secs (#ExecTimeout), the execution is stopped
'and the script called AfterTimeout is executed (the file AfterTimeout.rob must exist).
#ScriptAftertimeout$="AfterTimeout"
#Exectimeout=30
#Actiontimeout=15
Shell("notepad")
'The window does not exist and so the script fails.
UseWindow("toto")
And the script called after this first script is killed has just one line:
ret=Hardcopy("C:\program files\wintask\scripts\error.jpg",1,1)