Показать полную графическую версию : [решено] Вписывание прогресс-бара в гуи-форму
saavaage
09-08-2010, 14:37
Есть такой скрипт (за основу, помоему, взят скрипт пргресс-бара от CreatOr):
#include <IE.au3>
#include <Timers.au3>
Global $i_Timer, $sTest, $h_Timer_GUI, $i_Precent = 0
_ProgressOn()
While 1
Call("Internet"); вызывается проверка скорости интернета
ExitLoop
WEnd
_Timer_KillTimer($h_Timer_GUI, $i_Timer)
MsgBox(4096, "Интернет", "Текущая скорость:" & @LF & @LF & " " & $sTest & " Кб/с")
Func _ProgressOn($sTitle="", $sMainText="", $sSubText="", $iXPos=-1, $iYPos=-1, $iOpt=16)
ProgressOn($sTitle, $sMainText, $sSubText, $iXPos, $iYPos, $iOpt)
$i_Timer = _Timer_SetTimer($h_Timer_GUI, 500, "_ProgressSet")
EndFunc
Func _ProgressSet($hWnd, $Msg, $iIDTimer, $dwTime)
;Увеличиваем прогресс на 5 единиц
$i_Precent += 2
ProgressSet($i_Precent)
;Если достигли 100 процентов, сбрасываем на 0.
If $i_Precent = 100 Then $i_Precent = 0
EndFunc
Func Internet()
$oIE = _IECreate("http://www.spbtlg.ru/index.html", 0, 0)
_IENavigate($oIE, "http://www.spbtlg.ru/stb.php")
$sTest = _IEBodyReadText($oIE)
_IEQuit($oIE)
$sCut_Word = " = "
$sCut_Word1 = @LF
$sTest = StringRegExpReplace($sTest, "(?is)\A.*?(" & $sCut_Word & ".*?)$", "\1")
$sTest = StringRegExpReplace($sTest, "(?is)\A(.*?)" & $sCut_Word1 & ".*?$", "\1")
$sTest = StringReplace($sTest, " = ", "")
$sTest = StringReplace($sTest, ".", ",")
$sTest = StringStripCR($sTest)
EndFunc
В принципе, все отрабатывает нормально, но не могу решить задачу по размещению этого прогресс-бара в нужном месте своей гуи-формы.:
GUICreate("My form", 220, 100, 100, 200)
$progressbar = GUICtrlCreateProgress(10, 10, 200, 20)
$button = GUICtrlCreateButton("Start", 75, 70, 70, 20)
GUISetState()
а именно, разместить его вместо $progressbar
PS прогресс-бар выполняет простую функцию сигнализирования о том, что задача проверки выполняется.
madmasles
09-08-2010, 15:50
saavaage,
Я не совсем понял, Вам надо отдельное окно с прогресс-баром? Если нет, то попробуйте так:#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <GUIConstantsEx.au3>
$j = False (http://www.autoitscript.com/autoit3/docs/keywords.htm#False)
$i = 0
$z = 2
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate (http://www.autoitscript.com/autoit3/docs/functions/GUICreate.htm)("Form1", 300, 200, -1, -1)
$Label1 = GUICtrlCreateLabel (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateLabel.htm)('', 125, 20, 50, 20)
$Progress1 = GUICtrlCreateProgress (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateProgress.htm)(50, 50, 200, 20)
$Button1 = GUICtrlCreateButton (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateButton.htm)("Start", 100, 100, 100, 50)
GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)(@SW_SHOW (http://www.autoitscript.com/autoit3/docs/macros.htm#@sw_show))
#endregion ### END Koda GUI section ###
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
$nMsg = GUIGetMsg (http://www.autoitscript.com/autoit3/docs/functions/GUIGetMsg.htm)()
Switch (http://www.autoitscript.com/autoit3/docs/keywords.htm#Switch) $nMsg
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $GUI_EVENT_CLOSE
Exit (http://www.autoitscript.com/autoit3/docs/keywords.htm#Exit)
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $Button1
$j = Not (http://www.autoitscript.com/autoit3/docs/keywords.htm#Not) $j
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $j Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
GUICtrlSetData (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetData.htm)($Button1, "Stop")
GUICtrlSetData (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetData.htm)($Label1, "Work")
AdlibRegister (http://www.autoitscript.com/autoit3/docs/functions/AdlibRegister.htm)('_MyFunc', 50)
Else (http://www.autoitscript.com/autoit3/docs/keywords.htm#Else)
GUICtrlSetData (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetData.htm)($Button1, "Start")
GUICtrlSetData (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetData.htm)($Label1, "No Work")
AdlibUnRegister (http://www.autoitscript.com/autoit3/docs/functions/AdlibUnRegister.htm)('_MyFunc')
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
EndSwitch (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSwitch)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) _MyFunc()
$i += $z
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $i = 100 Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) $z = -2
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $i = 0 Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) $z = 2
GUICtrlSetData (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetData.htm)($Progress1, $i)
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc) ;==>_MyFunc
saavaage
09-08-2010, 16:04
madmasles, схема скрипта такова:
при нажатии на кнопку старт запускается пргресс-бар, затем выполнение функции "Internet". Прогресс-бар работает постоянно пока выполняется работа функции "Internet". После того, как функция выполнена, прогресс замирает и после закрытия месседж-бокса с результатом, обнуляется.
Не совсем понимаю, как "втиснуть" в ваш скрипт выполнение функции "Internet"
saavaage
09-08-2010, 17:21
madmasles, разобрался походу, работает вот такой скрипт:
#include <GUIConstantsEx.au3>
#include <IE.au3>
$j = False
$i = 0
$z = 2
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 300, 200, -1, -1)
$Label1 = GUICtrlCreateLabel('Начни проверку!', 105, 20, 100, 20)
$Progress1 = GUICtrlCreateProgress(50, 50, 200, 20)
$Button1 = GUICtrlCreateButton("Замерить", 100, 100, 100, 50)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
GUICtrlSetData($Label1, "Идет проверка!")
AdlibRegister('_MyFunc', 50)
While 1
Call("Internet")
ExitLoop
WEnd
GUICtrlSetData($Label1, "Начни проверку!")
AdlibUnRegister('_MyFunc')
$i = 0
GUICtrlSetData($Progress1, $i)
EndSwitch
WEnd
Func _MyFunc()
$i += $z
If $i = 100 Then $z = -2
If $i = 0 Then $z = 2
GUICtrlSetData($Progress1, $i)
EndFunc ;==>_MyFunc
Func Internet()
$oIE = _IECreate("http://www.spbtlg.ru/index.html", 0, 0)
_IENavigate($oIE, "http://www.spbtlg.ru/stb.php")
$sTest = _IEBodyReadText($oIE)
_IEQuit($oIE)
$sCut_Word = " = "
$sCut_Word1 = @LF
$sTest = StringRegExpReplace($sTest, "(?is)\A.*?(" & $sCut_Word & ".*?)$", "\1")
$sTest = StringRegExpReplace($sTest, "(?is)\A(.*?)" & $sCut_Word1 & ".*?$", "\1")
$sTest = StringReplace($sTest, " = ", "")
$sTest = StringReplace($sTest, ".", ",")
$sTest = StringStripCR($sTest)
MsgBox(4096, "Интернет", "Текущая скорость:" & @LF & @LF & " " & $sTest & " Кб/с")
EndFunc
Если можно, то взгляните на предмет оптимизации. Я не уверен, что все сделал правильно.
madmasles
09-08-2010, 17:34
saavaage,
Попробуйте так:#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <GUIConstantsEx.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <GIFAnimation.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <IE.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <StaticConstants.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <GuiMenu.au3>
Opt (http://www.autoitscript.com/autoit3/docs/functions/Opt.htm)("MustDeclareVars", 1)
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) $sResume = 'Error', $pGIF, _
$sFileGIF = @WindowsDir (http://www.autoitscript.com/autoit3/docs/macros.htm#@windowsdir) & "\pchealth\helpctr\System\images\progbar.gif", _
$Form1, $Label1, $hGIF, $Button1, $nMsg, $hMenu
$Form1 = GUICreate (http://www.autoitscript.com/autoit3/docs/functions/GUICreate.htm)("Form1", 300, 200, -1, -1)
$Label1 = GUICtrlCreateLabel (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateLabel.htm)('', 50, 20, 200, 20, $SS_CENTER)
$hGIF = _GUICtrlCreateGIF($sFileGIF, "", 75, 50, $pGIF)
_GIF_PauseAnimation($pGIF)
$Button1 = GUICtrlCreateButton (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateButton.htm)("Start", 100, 100, 100, 50)
$hMenu = _GUICtrlMenu_GetSystemMenu (http://dundats.mvps.org/help/html/libfunctions/_guictrlmenu_getsystemmenu.htm)($Form1)
GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)(@SW_SHOW (http://www.autoitscript.com/autoit3/docs/macros.htm#@sw_show))
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
$nMsg = GUIGetMsg (http://www.autoitscript.com/autoit3/docs/functions/GUIGetMsg.htm)()
Switch (http://www.autoitscript.com/autoit3/docs/keywords.htm#Switch) $nMsg
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $GUI_EVENT_CLOSE
Exit (http://www.autoitscript.com/autoit3/docs/keywords.htm#Exit)
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $Button1
_GUICtrlMenu_EnableMenuItem (http://dundats.mvps.org/help/html/libfunctions/_guictrlmenu_enablemenuitem.htm)($hMenu, $SC_CLOSE, 2)
GUICtrlSetState (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetState.htm)($Button1, $GUI_DISABLE)
GUICtrlSetData (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetData.htm)($Label1, "")
_GIF_ResumeAnimation($pGIF)
_SpeedInternet()
_GIF_PauseAnimation($pGIF)
GUICtrlSetData (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetData.htm)($Label1, "Ваша скорость: " & $sResume)
GUICtrlSetState (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetState.htm)($Button1, $GUI_ENABLE)
_GUICtrlMenu_EnableMenuItem (http://dundats.mvps.org/help/html/libfunctions/_guictrlmenu_enablemenuitem.htm)($hMenu, $SC_CLOSE, 0)
EndSwitch (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSwitch)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) _SpeedInternet()
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $sPattern = '(?s).*?= (.*?)\r\n?.*', $sText
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $oIE = _IECreate (http://dundats.mvps.org/help/html/libfunctions/_iecreate.htm)("http://www.spbtlg.ru/index.html", 0, 0)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) Not (http://www.autoitscript.com/autoit3/docs/keywords.htm#Not) IsObj (http://www.autoitscript.com/autoit3/docs/functions/IsObj.htm)($oIE) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) $sResume
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) _IENavigate (http://dundats.mvps.org/help/html/libfunctions/_ienavigate.htm)($oIE, "http://www.spbtlg.ru/stb.php") <> -1 Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
_IEQuit (http://dundats.mvps.org/help/html/libfunctions/_iequit.htm)($oIE)
Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) $sResume
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
$sText = _IEBodyReadText (http://dundats.mvps.org/help/html/libfunctions/_iebodyreadtext.htm)($oIE)
_IEQuit (http://dundats.mvps.org/help/html/libfunctions/_iequit.htm)($oIE)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $sText Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$sText = StringRegExpReplace (http://www.autoitscript.com/autoit3/docs/functions/StringRegExpReplace.htm)($sText, $sPattern, "\1")
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) Number (http://www.autoitscript.com/autoit3/docs/functions/Number.htm)($sText) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) $sResume = $sText & ' Kbps'
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) $sResume
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc) ;==>_SpeedInternet
GIFAnimation.au3 (http://www.autoitscript.com/forum/index.php?showtopic=96132&hl=GIFAnimationau3&st=0)
saavaage
09-08-2010, 18:16
madmasles, прекрасно! Использую Ваше решение.
Но, на всякий случай, просмотрите мое решение - мне важно знать свои ошибки (я только начал изучать).
madmasles
09-08-2010, 19:30
saavaage,
1. В Вашем коде кнопку $Button1, после нажатия, надо сделать неактивной, а после отработки функции Internet() - активной, чтобы нельзя было нажать на нее во время работы функции.
2. Конструкция
While 1
Call("_SpeedInternet")
ExitLoop
WEndЛучше, чем в моем скрипте, если ее использовать в моем, то можно убрать эти строки:
#include <GuiMenu.au3>
...
$hMenu = _GUICtrlMenu_GetSystemMenu($Form1)
...
_GUICtrlMenu_EnableMenuItem($hMenu, $SC_CLOSE, 2)
...
_GUICtrlMenu_EnableMenuItem($hMenu, $SC_CLOSE, 0)
3. Функция и так работает:Func _SpeedInternet()
Local $sPattern = '(?s).*?= (.*?)\r\n?.*', $sText
Local $oIE = _IECreate("http://www.spbtlg.ru/stb.php", 0, 0)
If Not IsObj($oIE) Then Return $sResume
$sText = _IEBodyReadText($oIE)
_IEQuit($oIE)
If $sText Then
$sText = StringRegExpReplace($sText, $sPattern, "\1")
If Number($sText) Then $sResume = $sText & ' Kbps'
EndIf
Return $sResume
EndFunc ;==>_SpeedInternet
4. Все вышеизложенное - мое субъективное мнение. :)
saavaage
09-08-2010, 19:49
madmasles, Вы правы. Т.о. окончательный мой код (уже в правильной редакции) будет таким:
#include <GUIConstantsEx.au3>
#include <IE.au3>
$j = False
$i = 0
$z = 2
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 300, 200, -1, -1)
$Label1 = GUICtrlCreateLabel('Начни проверку!', 105, 30, 100, 20)
$Progress1 = GUICtrlCreateProgress(50, 50, 200, 20)
$Button1 = GUICtrlCreateButton("Замерить", 100, 100, 100, 50)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
;GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
ControlDisable("Form1", "", $Button1)
GUICtrlSetData($Label1, "Идет проверка!")
AdlibRegister('_MyFunc', 50)
While 1
Call("Internet")
ExitLoop
WEnd
GUICtrlSetData($Label1, "Начни проверку!")
AdlibUnRegister('_MyFunc')
$i = 0
GUICtrlSetData($Progress1, $i)
ControlEnable("Form1", "", $Button1)
EndSwitch
WEnd
Func _MyFunc()
$i += $z
If $i = 100 Then $z = -2
If $i = 0 Then $z = 2
GUICtrlSetData($Progress1, $i)
EndFunc ;==>_MyFunc
Func Internet()
$oIE = _IECreate("http://www.spbtlg.ru/index.html", 0, 0)
_IENavigate($oIE, "http://www.spbtlg.ru/stb.php")
$sTest = _IEBodyReadText($oIE)
_IEQuit($oIE)
$sCut_Word = " = "
$sCut_Word1 = @LF
$sTest = StringRegExpReplace($sTest, "(?is)\A.*?(" & $sCut_Word & ".*?)$", "\1")
$sTest = StringRegExpReplace($sTest, "(?is)\A(.*?)" & $sCut_Word1 & ".*?$", "\1")
$sTest = StringReplace($sTest, " = ", "")
$sTest = StringReplace($sTest, ".", ",")
$sTest = StringStripCR($sTest)
MsgBox(4096, "Интернет", "Текущая скорость:" & @LF & @LF & " " & $sTest & " Кб/с")
EndFunc
а Ваш окончательный код такой:
#include <GUIConstantsEx.au3>
#include <GIFAnimation.au3>
#include <IE.au3>
#include <StaticConstants.au3>
Opt("MustDeclareVars", 1)
Global $sResume = 'Error', $pGIF, _
$sFileGIF = @WindowsDir & "\pchealth\helpctr\System\images\progbar.gif", _
$Form1, $Label1, $hGIF, $Button1, $nMsg, $hMenu
$Form1 = GUICreate("Form1", 300, 200, -1, -1)
$Label1 = GUICtrlCreateLabel('', 50, 20, 200, 20, $SS_CENTER)
$hGIF = _GUICtrlCreateGIF($sFileGIF, "", 75, 50, $pGIF)
_GIF_PauseAnimation($pGIF)
$Button1 = GUICtrlCreateButton("Start", 100, 100, 100, 50)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
GUICtrlSetState($Button1, $GUI_DISABLE)
GUICtrlSetData($Label1, "")
_GIF_ResumeAnimation($pGIF)
_SpeedInternet()
_GIF_PauseAnimation($pGIF)
GUICtrlSetData($Label1, "Ваша скорость: " & $sResume)
GUICtrlSetState($Button1, $GUI_ENABLE)
EndSwitch
WEnd
Func _SpeedInternet()
Local $sPattern = '(?s).*?= (.*?)\r\n?.*', $sText
Local $oIE = _IECreate("http://www.spbtlg.ru/stb.php", 0, 0)
If Not IsObj($oIE) Then Return $sResume
$sText = _IEBodyReadText($oIE)
_IEQuit($oIE)
If $sText Then
$sText = StringRegExpReplace($sText, $sPattern, "\1")
If Number($sText) Then $sResume = $sText & ' Kbps'
EndIf
Return $sResume
EndFunc ;==>_SpeedInternet
Я правильно понял?
madmasles
09-08-2010, 22:04
saavaage,
Мой такой будет:#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <GUIConstantsEx.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <GIFAnimation.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <IE.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <StaticConstants.au3>
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) $sResume, $pGIF, _
$sFileGIF = @WindowsDir (http://www.autoitscript.com/autoit3/docs/macros.htm#@windowsdir) & "\pchealth\helpctr\System\images\progbar.gif", _
$Form1, $Label1, $hGIF, $Button1, $nMsg, $hMenu
$Form1 = GUICreate (http://www.autoitscript.com/autoit3/docs/functions/GUICreate.htm)("Проверка скорости.", 250, 90, -1, -1)
$Label1 = GUICtrlCreateLabel (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateLabel.htm)('Проверка скорости интернета.', 10, 10, 230, 20, $SS_CENTER)
$Button1 = GUICtrlCreateButton (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateButton.htm)("Проверить", 85, 50, 80, 30)
GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)(@SW_SHOW (http://www.autoitscript.com/autoit3/docs/macros.htm#@sw_show))
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
$nMsg = GUIGetMsg (http://www.autoitscript.com/autoit3/docs/functions/GUIGetMsg.htm)()
Switch (http://www.autoitscript.com/autoit3/docs/keywords.htm#Switch) $nMsg
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $GUI_EVENT_CLOSE
Exit (http://www.autoitscript.com/autoit3/docs/keywords.htm#Exit)
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $Button1
$hGIF = _GUICtrlCreateGIF($sFileGIF, "", 50, 30, $pGIF)
GUICtrlSetState (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetState.htm)($Button1, $GUI_DISABLE)
GUICtrlSetData (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetData.htm)($Label1, "Подождите, идет проверка.")
Call (http://www.autoitscript.com/autoit3/docs/functions/Call.htm)("_SpeedInternet")
_GIF_DeleteGIF($pGIF)
GUICtrlSetData (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetData.htm)($Label1, $sResume)
GUICtrlSetState (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetState.htm)($Button1, $GUI_ENABLE)
EndSwitch (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSwitch)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) _SpeedInternet()
$sResume = 'Произошла ошибка.'
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $sPattern = '(?s).*?= (.*?)\r\n?.*', $sText
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $oIE = _IECreate (http://dundats.mvps.org/help/html/libfunctions/_iecreate.htm)("http://www.spbtlg.ru/stb.php", 0, 0)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) Not (http://www.autoitscript.com/autoit3/docs/keywords.htm#Not) IsObj (http://www.autoitscript.com/autoit3/docs/functions/IsObj.htm)($oIE) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) $sResume
$sText = _IEBodyReadText (http://dundats.mvps.org/help/html/libfunctions/_iebodyreadtext.htm)($oIE)
_IEQuit (http://dundats.mvps.org/help/html/libfunctions/_iequit.htm)($oIE)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $sText Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$sText = StringRegExpReplace (http://www.autoitscript.com/autoit3/docs/functions/StringRegExpReplace.htm)($sText, $sPattern, "\1")
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) Number (http://www.autoitscript.com/autoit3/docs/functions/Number.htm)($sText) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) $sResume = "Ваша скорость: " & $sText & ' Kbps'
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) $sResume
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc) ;==>_SpeedInternet
saavaage
09-08-2010, 22:16
madmasles, спасибо большое, тема закрыта
© OSzone.net 2001-2012
vBulletin v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.