Page 1 sur 1

[R] _IELinkGetCollection Repeté

Posté : sam. 11 avr. 2009 21:20
par Xero
Bonjour :)

J'ai un soucis avec la fonction : _IELinkGetCollection .
Je vous montre :

Code : Tout sélectionner

$sBat1 = "Suivant"
$oLinks1 = _IELinkGetCollection($oIE)
For $oLink1 In $oLinks1 
    $sLinkText1 = _IEPropertyGet($oLink1, "innerText")
    If StringInStr($sLinkText1, $sBat1) Then
        _IEAction($oLink1, "click")
        ExitLoop
    EndIf
Next
Donc en faite, ça clique bien sur le mot suivant, pas de soucis :)

Mais j'aimerai qu'il clique sur le suivant d'après .

Exemple :

Actuellement : Suivant - Suivant - Suivant
Ce que je voudrais : Suivant - Suivant - Suivant

Vous voyez ce que je veux dire ? ;p

Voila, merci de m'aider .

Re: [..] _IELinkGetCollection Repeté

Posté : sam. 11 avr. 2009 23:46
par GaRydelaMer
Bonsoir

pas vraiment compliquer, avant de clicker sur le lien, tu les comptes avant !!

Code : Tout sélectionner

$compteur = 1
$sBat1 = "Suivant"
$sCompteur = 2

$oLinks1 = _IELinkGetCollection($oIE)
For $oLink1 In $oLinks1 
    $sLinkText1 = _IEPropertyGet($oLink1, "innerText")
    If StringInStr($sLinkText1, $sBat1) Then
        $compteur += 1
        If $compteur = scompteur Then _IEAction($oLink1, "click")
        ExitLoop
    EndIf
Next
 

Re: [..] _IELinkGetCollection Repeté

Posté : dim. 12 avr. 2009 00:59
par Xero
J'avais pensais à cette solution, mais ça ne marche pas x)

Ça me clique toujours sur le premier ;/

Re: [..] _IELinkGetCollection Repeté

Posté : dim. 12 avr. 2009 01:13
par GaRydelaMer
Re

Ca devrait marcher pourtant, un bug dans _IE ? sur la collection ?
on peux essayer autre chose:

Code : Tout sélectionner

    If StringInStr($sLinkText1, $sBat1) Then
        $compteur += 1
        If $compteur = scompteur Then _IENavigate($oIE, $oLink1.href)
        ExitLoop
    EndIf

 

Re: [..] _IELinkGetCollection Repeté

Posté : dim. 12 avr. 2009 01:33
par Xero
Même chose oO

Je vois aucune autre solution ;/

Le coup du je déplace ma souris m'intéresse pas trop ... ;/

Si tu vois une solution ^^

Re: [..] _IELinkGetCollection Repeté

Posté : dim. 12 avr. 2009 01:44
par GaRydelaMer
Pas trop d'autre solution, donnes nous un bout du code source de la page.

Re: [..] _IELinkGetCollection Repeté

Posté : dim. 12 avr. 2009 02:59
par GaRydelaMer
Ca y'est trop bête comme erreur en plus !!

Code : Tout sélectionner

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

_IEErrorHandlerRegister()

$oIE = _IECreateEmbedded()
GUICreate("Embedded Web control Test", @DesktopWidth - 500, @DesktopHeight - 500, -1, -1, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 10, @DesktopWidth - 530, @DesktopHeight - 530)
GUISetState() ;Show GUI
_IENavigate($oIE, "http://www.autoitscript.fr/forum/search.php?search_id=newposts")

;~ _IENavigate($oIE, "about&#058;blank")
;~ $sHTML = "<h1>Hello World!</h1>"
;~ _IEBodyWriteHTML($oIE, $sHTML)

$sBat1 = "GaRydelaMer"
$iCompt = 2
$iLoop = 1

$oLinks1 = _IELinkGetCollection($oIE)
For $oLink1 In $oLinks1
    If StringInStr($oLink1.innerText, $sBat1) Then
        ConsoleWrite("++" & $iLoop & " => " & $oLink1.innerText & " - " & $oLink1.href & @LF)
        If $iCompt = $iLoop Then
            ConsoleWrite("!! _IEAction($oLink1)" & @LF)
            _IEAction($oLink1, "click")
            ExitLoop
        EndIf
        $iLoop += 1
    EndIf
Next
; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd
 

Re: [..] _IELinkGetCollection Repeté

Posté : dim. 12 avr. 2009 11:26
par Xero
Et bien un gros merci à toi :)