Description
The #ActionTimeout
system variable specifies the number of seconds which WinTask should wait before reporting a runtime error when it tries to select a window, a control, or an option in a menu.
Usage
Mainly used to increase the delay before an execution error is reported. For example, a file download is finished when a new window is displayed – a UseWindow
statement in the script makes the synchronization which waits until the new window is there; but the wait is done by default for 30 seconds. If the file download lasts more than 30 seconds, before the UseWindow
, you have to add a line #ActionTimeout=120
if you need to wait for 120 seconds.
Syntax
#ActionTimeout = n
Remarks
When n
seconds have elapsed, if WinTask cannot find the object it must activate, error management is launched. The default behavior (#IgnoreErrors=0
) is that an error message is displayed and the script execution stops.
The default value for #ActionTimeout
is 30 seconds. If this variable is set to 0, WinTask waits forever.
The functions affected by this system variable are:
CheckedHTML(), ChooseItem(), ChooseMenu(), Click(), ClickHTMLELement(),
ClickOnBitmap(), ClickOnText(), ClickOnTextOCR, ClickScrollBar(), ClickSpin(),
CloseWindow(), CopyLink(), MaximizeWindow(), MinimizeWindow(),
MoveWindow(), Navigate(), RestoreWindow(), SavePictureAs(), SaveTargetAs(),
SizeWindow(), StartBrowser(), UsePage(), UseWindow(), WinScrollBar(),
WriteCombo(), WriteEdit(), WriteHTML(), WriteHTMLEncrypted()
See Also
#IgnoreErrors
Example
#ActionTimeout = 5
Example code
This script detects if the Notepad window is present or not.
#IgnoreErrors=1
' Error management is now active in the script
#ActionTimeout=10
' Maximum wait is 10 seconds
ret=UseWindow("NOTEPAD.EXE|Edit|Untitled - Notepad|1")
' We try to do actions on the Notepad window
' The return code is tested
if ret=0 then
msgbox("Notepad window is present")
else
msgbox("Notepad window is not present")
endif
#IgnoreErrors=0
' Error management is turned off
' The script stops if an error occurs