Click
Windows management function.
The Click function simulates a click on a button, a checkbox, a radiobutton or a tab.
Usage
Used to click a control on a Windows application. The Click function is object-oriented (compared to ClickMouse function) and will replay correctly even if the control has been moved. Only standard Windows controls work with Click function ; many applications use images or non-standard controls. In such case, use ClickOnBitmap function or ClickMouse.
Syntax
Click(Button,<button_name>)
Click(Radio,<radio_name>)
Click(Check,<check_name>[,On or Off])
Click(Tab,<tab_name>)or
ret=Click(Button,<button_name>)
ret=Click(Radio,<radio_name>)
ret=Click(Check,<check_name>[,On or Off])
ret=Click(Tab,<tab_name>)Parameters
Button, Radio, Check, Tab : keywords defining the control type. During the time delay specified by #ActionTimeout, WinTask tries to find this item in the window specified by the last UseWindow statement and selects it. If the item is not found, an error is generated and the script is stopped.
Return value
Ret, numeric return code. When successful, the function returns 0, otherwise use this return code for Error Handling.
Example code
This script shows the different uses of the Click statement in the Windows control panel.
'Launch control panel
shell("control.exe")
'Click(Tab, )
UseWindow("EXPLORER.EXE|SHELLDLL_DefView|Control Panel|1",1)
ChooseItem(ListView,"1","Date and Time",double)
UseWindow("RUNDLL32.EXE|#32770|Date/Time Properties",1)
MsgBox("Wintask simulates a click on Time Zone tab")
Click(Tab,"Time Zone")
'Click(Check, )
UseWindow("RUNDLL32.EXE|#32770|Time Zone",1)
MsgBox("Wintask simulates a click on the checkbutton Automatically adjust clock...")
Click(Check,"Automatically adjust clock for &daylight saving changes",OFF)
'Click(Button, )
UseWindow("RUNDLL32.EXE|#32770|Date/Time Properties",1)
MsgBox("Wintask simulates a click on the button Cancel")
Click(Button,"Cancel")
'Close Control panel
CloseWindow("EXPLORER.EXE|CabinetWClass|Control Panel",1)