1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| Sub ChangerTexteEnigme()
'Déclaration des variables
Dim i, l As Single
Dim wTexte, actEnigme, newEnigme As String
Dim coderr As Byte
Dim noCiste, Pseudo As String
noCiste = "56909": Pseudo = "geracole"
' Chargement de la page web de ciste.net
coderr = 1
Set IE = New InternetExplorer
IE.Navigate "https://www.cistes.net"
' Affichage de la 1ere fenêtre
coderr = 2
If WaitIE(IE, 30) Then GoTo esub 'premier appel wait 30s pour lancer IE
IE.Visible = True
IE.Navigate "https://www.cistes.net/infos.php"
' Affichage des données personnelles
coderr = 3
If WaitIE(IE, 30) Then GoTo esub 'premier appel wait 30s pour lancer IE
' Affichage des cistes cachées
IE.Navigate "https://www.cistes.net/infoscistesc.php"
If WaitIE(IE, 30) Then GoTo esub 'premier appel wait 30s pour lancer IE
' Lancer la page modifier l'énigme
coderr = 4
'-> Fonctionne
Call IE.document.parentWindow.execScript("validModifEnigme(""56909"",""geracole"")", "JavaScript")
' -> ne marche pas
Call IE.document.parentWindow.execScript("validModifEnigme(nociste,pseudo)", "JavaScript")
Call IE.document.parentWindow.execScript("validModifEnigme(" & Chr(34) & Chr(34) & noCiste & Chr(34) & Chr(34) & "," _
& Chr(34) & Chr(34) & Pseudo & Chr(34) & Chr(34) & ")" & Chr(34) & "," _
& Chr(34) & "JavaScript" & Chr(34))
'-> Essai avec variable
Dim funct As String
funct = Chr(34) & "validModifEnigme(" & Chr(34) & Chr(34) & noCiste & Chr(34) & Chr(34) & "," _
& Chr(34) & Chr(34) & Pseudo & Chr(34) & Chr(34) & ")" & Chr(34) & "," _
& Chr(34) & "JavaScript" & Chr(34)
Debug.Print funct
Call IE.document.parentWindow.execScript(funct)
' suite do code effacé
esub:
IE.Quit
End Sub
' Attend que la page internet soit chargée
' pTimeOut est un time out en secondes (WaitIE vaut True si Timeout)
Public Function WaitIE(oIE As InternetExplorer, Optional pTimeOut As Long = 10) As Boolean
Dim lTimer As Double
lTimer = Timer
Do
DoEvents
If oIE.readyState = READYSTATE_COMPLETE And Not oIE.Busy Then Exit Do
If pTimeOut > 0 And Timer - lTimer > pTimeOut Then
WaitIE = True: MsgBox ("Time-Out Internet Explorer")
Exit Do
End If
Loop
End Function |
Partager