#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <GDIPlus.au3>
Global $oForm
Global $sPath = @ScriptDir & "\avatar.jpg"
_GDIPlus_Startup ()
$oIE = _IECreate("http://www.moswar.ru/")
#Region ### START Koda GUI section ### Form=
$Form = GUICreate("Form1", 105, 133, 192, 114)
$BottonSend = GUICtrlCreateButton("Войти", 14, 96, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
_ShowAvatar()
Select
Case $nMsg = $GUI_EVENT_CLOSE
_GDIPlus_ShutDown ()
Exit
Case $nMsg = $BottonSend
_Submit()
EndSelect
WEnd
Func _Load() ; Загружаем и сохраняем картинку
$oDiv = _IEGetObjById ($oIE, "personal")
$oImgs = _IETagNameGetCollection ($oDiv, "img")
For $oImg In $oImgs
$sAvatar = $oImg.src
Next
InetGet($sAvatar, $sPath, 1)
_ShowAvatar()
EndFunc
Func _ShowAvatar() ; Показываем картинку в GUI
$hBitmap = _GDIPlus_BitmapCreateFromFile ($sPath)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($Form)
_GDIPlus_GraphicsDrawImage ($hGraphic, $hBitmap, 10, 5)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_BitmapDispose ($hBitmap)
Sleep(30)
EndFunc
Func _Submit() ; Отправляем данные
Local $sLogin = "" ; Логин
Local $sPass = "" ; Пароль
$oForm = _IEFormGetCollection ($oIE, 0)
$oInputs = _IETagNameGetCollection ($oForm, "img")
$sNW_login = _IEFormElementGetObjByName($oForm, "email")
_IEFormElementSetValue($sNW_login, $sLogin)
$sNW_pass = _IEFormElementGetObjByName($oForm, "password")
_IEFormElementSetValue($sNW_pass, $sPass)
_IEFormElementCheckboxSelect ($oForm, 0,"remember", 0, "byIndex")
_IEFormSubmit($oForm)
_IELoadWait ($oIE)
If Not FileExists($sPath) Then _Load()
EndFunc