D�finit la valeur d'un �l�ment donn� de formulaire
#include <IE.au3>
_IEFormElementOptionSelect ( ByRef $oObject, $sString [, $iSelect = 1 [, $sMode = "byValue" [, $iFireEvent = 1]]] )
$oObject | Objet Form Element de type "Select Option" |
$sString | Valeur utilis�e pour d�terminer l'�l�ment - traitement selon $sMode |
$iSelect | [optionnel] Sp�cifie si l'�l�ment doit �tre activ� ou d�sactiv� -1 = Retourne l'�tat de la s�lection 0 = S�lectionne l'�l�ment 1 = (par d�faut) D�s�lectionne l'�l�ment |
$sMode | [optionnel] Sp�cifie le mode de recherche: "byValue" = (par d�faut) de l'option que vous souhaitez s�lectionner "byText" = texte de l'option que vous souhaitez s�lectionner "byIndex" = index, � prtir de 0 de l'option que vous souhaitez s�lectionner |
$iFireEvent | [optionnel] Indique si il faut d�clencher les �v�nements OnChange et OnClick apr�s avoir chang� la valeur 0 = ne pas d�clencher les �v�nements OnChange ou OnClick cas apr�s avoir chang� la valeur 1 = (par d�faut) D�clencher les �v�nements OnChange et OnClick apr�s avoir chang� la valeur |
Succ�s: | Retourne l'�tat actuellement s�lectionn� si $iS�lecteur = -1, sinon retourne 1. |
�chec: | Retourne 0 et d�finit @error <> 0. |
@error: | 3 ($_IEStatus_InvalidDataType) - Type de donn�e invalide 4 ($_IEStatus_InvalidObjectType) - Type d'objet invalide 5 ($_IEStatus_InvalidValue) - Valeur invalide 7 ($_IEStatus_NoMatch) - Pas de correspondance trouv�e |
@extended: | Contient le nombre de param�tres invalides |
Le param�tre $iFireEvent est significatif seulement si l'�l�ment de formulaire a un �v�nement onChange associ�.
_IEFormElementCheckBoxSelect, _IEFormElementGetValue, _IEFormElementRadioSelect, _IEFormElementSetValue
; Ouvre un navigateur avec l'exemple de formulaire, obtient une r�f�rence sur le formulaire, obtient une r�f�rence ; sur l'�l�ment s�lectionn�, recommence 10 fois la s�lection des options byValue, byText et byIndex #include <IE.au3> Local $oIE = _IE_Example("form") Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm") Local $oSelect = _IEFormElementGetObjByName($oForm, "selectExample") _IEAction($oSelect, "focus") For $i = 1 To 10 _IEFormElementOptionSelect($oSelect, "Freepage", 1, "byText") Sleep(1000) _IEFormElementOptionSelect($oSelect, "midipage.html", 1, "byValue") Sleep(1000) _IEFormElementOptionSelect($oSelect, 0, 1, "byIndex") Sleep(1000) Next _IEQuit($oIE)
; Ouvre un navigateur avec l'exemple de formulaire, obtient une r�f�rence sur le formulaire, obtient une r�f�rence ; sur plusieurs �l�ments s�lectionn�s, recommence 5 fois la s�lection puis annule ; les options byValue, byText et byIndex. #include <IE.au3> Local $oIE = _IE_Example("form") Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm") Local $oSelect = _IEFormElementGetObjByName($oForm, "multipleSelectExample") _IEAction($oSelect, "focus") For $i = 1 To 3 _IEFormElementOptionSelect($oSelect, "Carlos", 1, "byText") Sleep(1000) _IEFormElementOptionSelect($oSelect, "Name2", 1, "byValue") Sleep(1000) _IEFormElementOptionSelect($oSelect, 5, 1, "byIndex") Sleep(1000) _IEFormElementOptionSelect($oSelect, "Carlos", 0, "byText") Sleep(1000) _IEFormElementOptionSelect($oSelect, "Name2", 0, "byValue") Sleep(1000) _IEFormElementOptionSelect($oSelect, 5, 0, "byIndex") Sleep(1000) Next _IEQuit($oIE)
; Ouvre un navigateur avec l'exemple de formulaire, obtient une r�f�rence sur le formulaire, obtient une r�f�rence ; sur l'�l�ment s�lectionn�, regarde si l'option "Freepage" est s�lectionn� et ; affiche le r�sultat. R�p�te pour l'option avec index 0 et pour l'option ; avec valeur 'midipage.html' #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IE_Example("form") Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm") Local $oSelect = _IEFormElementGetObjByName($oForm, "selectExample") If _IEFormElementOptionSelect($oSelect, "Freepage", -1, "byText") Then MsgBox($MB_SYSTEMMODAL, "Option Selected", "Option Freepage is selected") Else MsgBox($MB_SYSTEMMODAL, "Option Selected", "Option Freepage is Not selected") EndIf If _IEFormElementOptionSelect($oSelect, 0, -1, "byIndex") Then MsgBox($MB_SYSTEMMODAL, "Option Selected", "The First (index 0) option is selected") Else MsgBox($MB_SYSTEMMODAL, "Option Selected", "The First (index 0) option is Not selected") EndIf If _IEFormElementOptionSelect($oSelect, "midipage.html", -1, "byValue") Then MsgBox($MB_SYSTEMMODAL, "Option Selected", "The option with value 'midipage.html' is selected") Else MsgBox($MB_SYSTEMMODAL, "Option Selected", "The option with value 'midipage.html' is NOT selected") EndIf _IEQuit($oIE)