Set the value of a specified form element
#include <IE.au3>
_IEFormElementCheckBoxSelect ( ByRef $oObject, $sString [, $sName = "" [, $iSelect = 1 [, $sMode = "byValue" [, $iFireEvent = 1]]]] )
$oObject | Object variable of an InternetExplorer.Application, Form object |
$sString | Value used to match element - treatment based on $sMode |
$sName | [optional] Name or Id of checkbox(es) |
$iSelect | [optional] specifies whether element should be checked or unchecked -1 = Return checked state 0 = Uncheck the element 1 = (Default) Check the element |
$sMode | [optional] specify search mode "byValue" = (Default) value of the checkbox you wish to select "byIndex" = 0-based index of checkbox you wish to select |
$iFireEvent | [optional] specifies whether to fire OnChange and OnClick events after changing value 0 = do not fire OnChange or OnClick event after setting value 1 = (Default) fire OnChange and OnClick events after setting value |
Success: | the current checked state if $iSelect = -1, else returns 1. |
Failure: | 0 and sets the @error flag to non-zero. |
@error: | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type 5 ($_IEStatus_InvalidValue) = Invalid Value 7 ($_IEStatus_NoMatch) = No Match |
@extended: | Contains invalid parameter number |
The $iFireEvent parameter is significant only if the form element has an onChange event associated with it.
$sName is optional for this function.
If it is omitted, the function will operate on a collection of all <input type=checkbox> elements in the form.
If specified, the function will operate on a collection of <input type=checkbox> elements with that name.
_IEFormElementGetValue, _IEFormElementOptionSelect, _IEFormElementRadioSelect, _IEFormElementSetValue
; Open a browser with the form example, get reference to form, select and
; deselect the checkboxes byValue. Since $s_Name is not specified, operate
; on the collection of all <input type=checkbox> elements in the form
; Note: You will likely need to scroll down on the page to see the changes
#include <IE.au3>
Local $oIE = _IE_Example("form")
Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm")
For $i = 1 To 3
_IEFormElementCheckBoxSelect($oForm, "gameBasketball", "", 1, "byValue")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, "gameFootball", "", 1, "byValue")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, "gameTennis", "", 1, "byValue")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, "gameBaseball", "", 1, "byValue")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, "gameBasketball", "", 0, "byValue")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, "gameFootball", "", 0, "byValue")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, "gameTennis", "", 0, "byValue")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, "gameBaseball", "", 0, "byValue")
Sleep(1000)
Next
_IEQuit($oIE)
; Open a browser with the form example, get reference to form, select and
; deselect the checkboxes byIndex. Since $s_Name is not specified, operate
; on the collection of all <input type=checkbox> elements in the form
; Note: You will likely need to scroll down on the page to see the changes
#include <IE.au3>
Local $oIE = _IE_Example("form")
Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm")
For $i = 1 To 3
_IEFormElementCheckBoxSelect($oForm, 3, "", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, 2, "", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, 1, "", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, 0, "", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, 3, "", 0, "byIndex")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, 2, "", 0, "byIndex")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, 1, "", 0, "byIndex")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, 0, "", 0, "byIndex")
Sleep(1000)
Next
_IEQuit($oIE)
; Open a browser with the form example, get reference to form, select and
; deselect the checkboxes byIndex in the group that shares the name checkboxG2Example
; Note: You will likely need to scroll down on the page to see the changes
#include <IE.au3>
Local $oIE = _IE_Example("form")
Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm")
For $i = 1 To 3
_IEFormElementCheckBoxSelect($oForm, 0, "checkboxG2Example", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, 1, "checkboxG2Example", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, 0, "checkboxG2Example", 0, "byIndex")
Sleep(1000)
_IEFormElementCheckBoxSelect($oForm, 1, "checkboxG2Example", 0, "byIndex")
Sleep(1000)
Next
_IEQuit($oIE)