#include <Array.au3>
#include <INet.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiIPAddress.au3>
#Include <Date.au3>
#Region ### START Koda GUI section ###
$Form1_1 = GUICreate("MegaExchange.ru", 404, 124, 207, 130)
$Label1 = GUICtrlCreateLabel("Курс:", 16, 8, 47, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel(" ", 108, 8, 148, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("В кассе:", 16, 48, 73, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel(" ", 108, 48, 148, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Обновить", 280, 8, 107, 25)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("Выход", 280, 40, 107, 25)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
_GUICtrlStatusBar_SetSimple($StatusBar1)
_GUICtrlStatusBar_SetText($StatusBar1, "asdasd")
$Progress1 = GUICtrlCreateProgress(8, 81, 387, 13)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $price
Global $total
GetData()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
GetData()
Case $Button2
Exit
EndSwitch
WEnd
Func GetData()
_GUICtrlStatusBar_SetText($StatusBar1, "Обновляемся...")
HttpSetProxy(2, "192.168.1.201:3128")
Dim $sData = BinaryToString(InetRead('http://www.megaexchange.ru/'))
;$patern1 = '<tr><td class="label">(.*?)</td><td>(.*?)</td></tr>'
$patern1 = '<td>(\d+\.?\d+.*?) руб.</td>'
$patern2 = "(?i)\'auto\'\]\[6\]\[1\] = \'(.*?) WMR\'";
$aText = StringRegExp($sData, $patern1, 1)
If IsArray($aText) Then
$price = $aText[0]
GUICtrlSetData($Label2, $price & " WMR")
EndIf
$aText1 = StringRegExp($sData, $patern2, 1)
If IsArray($aText) Then
$total = $aText1[0]
GUICtrlSetData($Label4, $total & " WMR")
_GUICtrlStatusBar_SetText($StatusBar1, "Обновлено в " & _Now() )
EndIf
EndFunc