► Afficher le texte
Code : Tout sélectionner
#include-once
#include <IE.au3>
;===========================================================================================================================================
;
; Function Name: _IEGetObjByClass( ByRef $object, $Classname [, $index = -1] )
; Description:: Retourne un tableau de pointeur vers les objets Ie par leur nom de classes ou un pointeur unique si l'index est spécifié
; Parameter(s): $object = Pointeur vers un internetexplorer.application
; $Classname = Nom exacte de la class à rechercher
; $index = Spécifier l'élément du tableau à retourner (Commence à 1)
; Requirement(s): l'UDF IE.au3
; Return Value(s): Succes -> Si l'index est spécifié retourne le pointeur vers l'objet
; Sinon retourne un tableau donc $array[0] contient le nombre d'objet trouvé
; Erreur -> @Error: 0 ($_IEStatus_Success) = Aucune erreur
; 3 ($_IEStatus_InvalidDataType) = Type de donnée invalide
; 4 ($_IEStatus_InvalidObjectType) = Type d'objet invalide
; 5 ($_IEStatus_InvalidValue) = Donnée invalide
; 7 ($_IEStatus_NoMatch) = Aucun objet trouvé
; Auteur(s): Maxrioux100@hotmail.com (Bloodwolff)
;
;=============================================================================================================================================
Func _IEGetObjByClass($object,$Classname,$index = -1)
Vérif_objet($object)
If @error Then Return SetError(@error)
Dim $array[1] = 0
$oElements = _IETagNameAllGetCollection($object)
For $oElement in $oElements
If String($oElement.classname) = $Classname Then
$array[0]+=1
ReDim $array[$array[0]+1]
$array[$array[0]] = $oElement
EndIf
Next
If $index = -1 Then
Return $array
ElseIf $index <= $array[0] And >= 1 And IsInt($index) Then
Return $array[$index]
Else
Return SetError(1)
EndIf
EndFunc
;===========================================================================================================================================
;
; Function Name: _IEGetObjByText( ByRef $object, $Text [, $index = -1] )
; Description:: Retourne un tableau de pointeur vers les objets Ie par leur Texte ou un pointeur unique si l'index est spécifié
; Parameter(s): $object = Pointeur vers un internetexplorer.application
; $Texte = Texte exacte à rechercher
; $index = Spécifier l'élément du tableau à retourner (Commence à 1)
; Requirement(s): l'UDF IE.au3
; Return Value(s): Succes -> Si l'index est spécifié retourne le pointeur vers l'objet
; Sinon retourne un tableau donc $array[0] contient le nombre d'objet trouvé
; Erreur -> @Error: 0 ($_IEStatus_Success) = Aucune erreur
; 3 ($_IEStatus_InvalidDataType) = Type de donnée invalide
; 4 ($_IEStatus_InvalidObjectType) = Type d'objet invalide
; 5 ($_IEStatus_InvalidValue) = Donnée invalide
; 7 ($_IEStatus_NoMatch) = Aucun objet trouvé
; Auteur(s): Maxrioux100@hotmail.com (Bloodwolff)
;
;=============================================================================================================================================
Func _IEGetObjByText($object,$Text,$index = -1)
Vérif_objet($object)
If @error Then Return SetError(@error)
Dim $array[1] = 0
$oElements = _IETagNameAllGetCollection($object)
For $oElement in $oElements
If String($oElement.innertext) = $Text Then
$array[0]+=1
ReDim $array[$array[0]+1]
$array[$array[0]] = $oElement
EndIf
Next
If $index = -1 Then
Return $array
ElseIf $index <= $array[0] And >= 1 And IsInt($index) Then
Return $array[$index]
Else
Return SetError(1)
EndIf
EndFunc
;================================================================================================================
;######################################## Autre Fonctions ###################################################
;================================================================================================================
Func Vérif_objet($object) ;Tiré de l'include
If Not IsObj($object) Then
__IEErrorNotify("Error", "_IEQuit", "$_IEStatus_InvalidDataType")
Return SetError($_IEStatus_InvalidDataType, 1, 0)
EndIf
;
If Not __IEIsObjType($object, "browser") Then
__IEErrorNotify("Error", "_IEAction", "$_IEStatus_InvalidObjectType")
Return SetError($_IEStatus_InvalidObjectType, 1, 0)
EndIf
EndFunc ;Fin de la fonction