[R] Aller sur site internet

Aide et conseils concernant AutoIt et ses outils.
Règles du forum
.
Avatar du membre
jwelcsbe
Niveau 2
Niveau 2
Messages : 24
Enregistré le : ven. 20 avr. 2012 21:34
Localisation : CANADA
Status : Hors ligne

Re: [..] Aller sur site internet

#21

Message par jwelcsbe »

Je vous remercie à tous pour l'intéret que vous avez porter à la finalisation de ce projet.

Voici le script final :D

Code : Tout sélectionner

#include <GUIConstants.au3>
#include <IE.au3>

Global $archive = "C:\zabbix\archive.txt"  
Global $userselected = "wyselab01"
Global $passselected = "wyselab01"
Global $visible = 0  

_Check($userselected, $passselected, $visible)

;===============================================================

Func _Check($username, $password, $scriptvisible)
$wb = _IECreate ("https://courrier.csbe.qc.ca/owa/auth/logon.aspx?replaceCurrent=1&url=https%3a%2f%2fcourrier.csbe.qc.ca%2fowa%2f", 0, $scriptvisible, 1, 1)
$identif = _IEFormGetObjByName ($wb, "logonForm")
$login = _IEFormElementGetObjByName ($identif , "username")
$mdp = _IEFormElementGetObjByName ($identif , "password")
Local $oSubmit = _IEGetObjByName($wb, "submitExample")
_IEFormElementSetValue ($login, $username)
_IEFormElementSetValue ($mdp, $password)
WinActivate("Outlook")
$handle = ControlGetHandle("Outlook", "", "[CLASS:Internet Explorer_Server; INSTANCE:1]")
ControlFocus("Outlook", "", $handle)
ControlSend("Outlook", "", $handle , "{tab}")
ControlSend("Outlook", "", $handle , "{enter}")
_IELoadWait ($wb)

$file = FileOpen($archive, 2)     ; 2 = Write mode (erase previous contents)
If StringInStr($wb.locationurl, "logon") Then
    FileWrite($file, "0")   ; ECHEC
Else
    FileWrite($file, "1")   ; SUCCES
EndIf
FileClose($file)

$wb.visible = 1   ; vérification
_IEAction ($wb, "quit")   ; ferme IE
EndFunc
 
Merci à vous !
Répondre