#ScriptAfterTimeout$

System variable - Program flow management.

The #ScriptAfterTimeout$ system variable specifies the script that will be run when #ExecTimeout has elapsed. Not available in WinTask Lite.

Usage

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

Syntax

#ScriptAfterTimeout$ = "<script_to_launch.rob>"

Remarks

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 code.

See also

#ExecTimeout

Example

 

#ScriptAfterTimeout$ = "my_script"

'Note that as usual, if a blank is within the full path, you need to surround the string with Chr$(34) as below :
#ScriptAfterTimeout$=Chr$(34)+"E:\MICHAEL\script timeout\display message.rob"+Chr$(34)
'With parameters, the line would be :

#ScriptAfterTimeout$=Chr$(34)+"E:\MICHAEL\script timeout\display message.rob"+Chr$(34)+" param1 param2"

 

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 specified in #ScriptAfterTimeout$ variable 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= 'How It Works']")

 

UseWindow("IEXPLORE.EXE|ToolbarWindow32|WinTask - How it works - Microsoft Internet Explorer|5",1)

ChooseMenu(Normal,"Back")

 

pause 20

 

 

' Script killprocesses-------------------------------------------------

'In this example, we kill the two applications Internet Explorer and notepad.

KillApp("iexplore.exe",1)

KillApp("notepad.exe",1)