#include <IE.au3>
#include <File.au3>
#include <Array.au3>
Dim $aSearch[5] = [4, 'currency-gold', 'currency-credit', 'currency-experience', 'account-type-base png']
Dim $aResult[5][2] = [[0],['Золото'],['Кредиты'],['Свободный опыт'],['Тип аккаунта']]
_Del_Cookie()
$sUrl = 'http://worldoftanks.ru/auth/new/?next=/'
$sLogin = '[email protected]'
$sPassword = 'qwerty123'
$iError = 1
$oIE = _IECreate($sUrl)
If @error Then
MsgBox(16, 'Error', '_IECreate')
Exit
EndIf
For $i = 1 To 1
$oForm = _IEGetObjById($oIE, 'js-auth-form')
If @error Then ExitLoop
$oLogin = _IEFormElementGetObjByName($oForm, 'login')
If @error Then ExitLoop
$oPassword = _IEFormElementGetObjByName($oForm, 'password')
If @error Then ExitLoop
_IEFormElementSetValue($oLogin, $sLogin)
If @error Then ExitLoop
_IEFormElementSetValue($oPassword, $sPassword)
If @error Then ExitLoop
$oSubmits = _IETagNameGetCollection($oForm, 'input')
If @error Then ExitLoop
For $oSubmit In $oSubmits
If $oSubmit.value == 'Войти' And $oSubmit.type == 'submit' Then
_IEAction($oSubmit, 'click')
If @error Then ExitLoop 2
_IELoadWait($oIE)
If @error Then ExitLoop 2
ExitLoop
EndIf
Next
$iError = 0
Next
If $iError Then
MsgBox(16, 'Error', $iError)
_IEQuit($oIE)
Exit
Else
$iStart = TimerInit()
While TimerDiff($iStart) <= 20000
$iState = _IEPropertyGet($oIE, 'readystate')
If @error Then ContinueLoop
If $iState > 3 Then ExitLoop
Sleep(200)
WEnd
If $iState > 3 Then
For $j = 1 To 1
_IELinkClickByText($oIE, 'Личный кабинет ')
If @error Then ExitLoop
$oSpans = _IETagNameGetCollection($oIE, 'span')
If @error Then ExitLoop
For $oSpan In $oSpans
For $i = 1 To $aSearch[0]
If $oSpan.classname == $aSearch[$i] Then
$aResult[$i][1] = $oSpan.innertext
$aResult[0][0] += 1
EndIf
Next
If $aResult[0][0] = $aSearch[0] Then ExitLoop
Next
Next
EndIf
EndIf
_IEQuit($oIE)
If $aResult[0][0] Then
_ArrayDisplay($aResult)
Else
MsgBox(16, 'Error', 'Error')
EndIf
Func _Del_Cookie()
Local $a_Files_Cookie, $s_Path = @UserProfileDir & '\Cookies'
$a_Files_Cookie = _FileListToArray($s_Path, '*.txt', 1)
If @error Then Return
For $i = 1 To $a_Files_Cookie[0]
If Not FileDelete($s_Path & '\' & $a_Files_Cookie[$i]) Then
FileSetAttrib($s_Path & '\' & $a_Files_Cookie[$i], '-RS')
FileDelete($s_Path & '\' & $a_Files_Cookie[$i])
EndIf
Next
EndFunc ;==>_Del_Cookie