|
Компьютерный форум OSzone.net » Программирование, базы данных и автоматизация действий » AutoIt » скрипт для Yota |
|
скрипт для Yota
|
Новый участник Сообщения: 1 |
AutoIt: 3.3.14.2
Версия: 1.0.0.3 Категория: Автоматизация, Интернет, Разное Описание: Программа для автоматического управления скоростью доступа в интернет, в сетях yota. Автоматическая, сырая требует доработки т.е. настройка без GUI, и зависит от наличия программы BitMeter. Была написана для личного использования. Не судите строго просто решил поделиться с братьями по несчастью... Надеюсь на подсказки. Код/Пример: Скрытый текст
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=C:\Program Files\AutoIt3\Aut2Exe\Icons\AutoIt_Main_v10_256x256_RGB-A.ico #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y #AutoIt3Wrapper_AU3Check_Parameters=-d #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <IE.au3> #include <MsgBoxConstants.au3> #include <array.au3> #include <WinAPISys.au3> Global $otd, $vzl, $vzls = 0, $vzlss = 0, $speed, $oIE, $max Global $ostrongs, $srrs = False Global $obg, $obgn, $obgp Global $act = 1 sr() ;~ MsgBox(0,$otd,$vzl) ent() ref() povt() Func act() $act = _WinAPI_GetIdleTime() + $act / 2 EndFunc ;==>act ;~ _IELoadWait($oIE) ;~ enter() ;~ _IELoadWait($oIE) ;~ _IEAction($oIE,"refresh") ;~ _IELoadWait($oIE) Func ref() If IsObj($oIE) Then Local $url If StringInStr(_IEBodyReadText($oIE), "Произошла неизвестная ошибка") Then _IENavigate($oIE, "https://my.yota.ru/selfcare/devices") EndIf If StringInStr(_IEBodyReadText($oIE), "Не удается") Then _IENavigate($oIE, "https://my.yota.ru/selfcare/devices") EndIf $url = _IEPropertyGet($oIE, "locationurl") If StringInStr($url, "changeOffer") Then _IENavigate($oIE, "https://my.yota.ru/selfcare/devices") If $url <> "https://my.yota.ru/selfcare/devices" And $url <> "https://my.yota.ru/selfcare/login" Then _IENavigate($oIE, "https://my.yota.ru/selfcare/devices") ElseIf Not $srrs Then _IEAction($oIE, "refresh") povt() EndIf $url = _IEPropertyGet($oIE, "locationurl") If $url <> "https://my.yota.ru/selfcare/devices" And $url <> "https://my.yota.ru/selfcare/login" Then _IENavigate($oIE, "https://my.yota.ru/selfcare/devices") EndIf EndIf EndFunc ;==>ref Func ent() Local $errc, $aProcessList, $1, $url, $oIE1 ConsoleWrite("61, entering" & @CRLF) $errc = 0 While 1 Sleep(250) $oIE = _IECreate("https://my.yota.ru/selfcare/devices", 1, 1, 1, 0) If @error Then ConsoleWrite("67, err create - "& @error & @CRLF) $oIE1 = _IEAttach("my.yota.ru", "url") If @error Then ConsoleWrite("70, err att - "& @error & @CRLF) $aProcessList = ProcessList("iexplore.exe") For $i = 1 To $aProcessList[0][0] ProcessClose($aProcessList[$i][1]) Next ContinueLoop Else ConsoleWrite("77, att suc" & @CRLF) $oIE = $oIE1 EndIf EndIf ;~ $aProcessList = ProcessList("iexplore.exe") ;~ If $errc = 6 Then ;~ For $i = 1 To $aProcessList[0][0] ;~ ProcessClose($aProcessList[$i][1]) ;~ Next ;~ ContinueLoop ;~ EndIf $1 = WinWait("", "Internet Explorer", 5) If $1 > 0 Then WinSetState($1, "", @SW_MINIMIZE) ConsoleWrite("88, entering" & @CRLF) _IELoadWait($oIE, 1000, 10000) _IELoadWait($oIE, 1000, 10000) While StringInStr(_IEBodyReadText($oIE), "Вы не подключены к сети") Or StringInStr(_IEBodyReadText($oIE), "Личный кабинет временно недоступен") ConsoleWrite("95, entering" & @CRLF) Sleep(2000) _IENavigate($oIE, "https://my.yota.ru/selfcare/devices") ConsoleWrite("98, entering" & @CRLF) WEnd If StringInStr(_IEBodyReadText($oIE), "Вы не подключены к сети") Or StringInStr(_IEBodyReadText($oIE), "Личный кабинет временно недоступен") Then Sleep(20000) ContinueLoop EndIf If $errc > 5 Then _IEQuit($oIE) $aProcessList = ProcessList("iexplore.exe") If $aProcessList[0][0] > 0 Then For $i = 1 To $aProcessList[0][0] ProcessClose($aProcessList[$i][1]) Next EndIf $oIE = _IECreate("my.yota.ru", 1, 1, 1, 0) $1 = WinWait("", "Internet Explorer", 5) If $1 > 0 Then WinSetState($1, "", @SW_MINIMIZE) _IELoadWait($oIE) Sleep(300) _IELoadWait($oIE) $errc = 0 EndIf $url = _IEPropertyGet($oIE, "locationurl") If $url <> "https://my.yota.ru/selfcare/devices" And $url <> "https://my.yota.ru/selfcare/login" Then _IENavigate($oIE, "https://my.yota.ru/selfcare/devices") EndIf If @error <> 0 Then ContinueLoop ConsoleWrite("125 create" & @CRLF) _IEGetObjById($oIE, "logo") If @error Then enter() ConsoleWrite("129, entering - "& @error & @CRLF) EndIf _IELoadWait($oIE) _IEGetObjById($oIE, "logo") If @error = 0 Then ExitLoop $url = _IEPropertyGet($oIE, "locationurl") If $url = "https://my.yota.ru/selfcare/devices" Then ExitLoop Else ConsoleWrite("url=" & $url & @CRLF) EndIf $errc += 1 WEnd ConsoleWrite("entered" & @CRLF) _IELoadWait($oIE) Sleep(1000) _IELoadWait($oIE) EndFunc ;==>ent AdlibRegister("sr", 1000) AdlibRegister("act", 1000) AdlibRegister("srr", 5000) AdlibRegister("srrs", 15000) AdlibRegister("ref", 120000) AdlibRegister("povt", 50000) ;~ _IELinkClickByIndex($oIE, 22) Func povt() Local $hWnd $hWnd = WinWait("Windows Internet Explorer", "Чтобы еще раз отобразить эту веб-страницу", 3) If $hWnd Then ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:1]", "", 2) EndIf EndFunc ;==>povt While 1 Sleep(250) WEnd Func sr() Local $text, $n, $stl, $vzl1, $otd1 $text = WinGetText("BitMeter") $n = StringInStr($text, "отдал: ") $stl = StringLen($text) $otd1 = StringMid($text, $n + 7) $vzl1 = StringMid($text, 9, $n - 10) $otd = Number($otd1) $vzl = Number($vzl1) ;~ If $vzls < $vzl Then ;~ $vzls = $vzl ;~ Else $vzls = Floor(($vzls + $vzl) / 2) ;~ EndIf ;~ ConsoleWrite($vzlss & @CRLF) EndFunc ;==>sr Func srr() Local $ispeed $vzlss = Floor(($vzlss + $vzls + $vzl) / 3) If $act < 15000 Then $vzlss += 15 If Not $srrs Then Switch $vzlss Case 0 To 15 $ispeed = 0 Case 15 To 80 $ispeed = 1.0 Case 80 To 200 $ispeed = 2.1 Case 200 To 300 $ispeed = 3.1 Case 300 To 400 $ispeed = 4.1 Case 400 To 500 $ispeed = 5.0 Case 500 To 600 $ispeed = 6.4 Case 600 To 900 $ispeed = 8.5 Case 900 To 1050 $ispeed = 10.0 Case 1050 To 1300 $ispeed = 12.0 Case 1300 To 1700 $ispeed = 15.0 Case Else $ispeed = 20 EndSwitch If $ispeed > $speed Then srrs() EndIf EndFunc ;==>srr Func srrs() if not $srrs Then Local $iispeed, $err, $ispeed $srrs = True Switch $vzlss Case 0 To 15 $speed = 0 Case 15 To 80 $speed = 1.0 Case 80 To 200 $speed = 2.1 Case 200 To 300 $speed = 3.1 Case 300 To 400 $speed = 4.1 Case 400 To 500 $speed = 5.0 Case 500 To 600 $speed = 6.4 Case 600 To 900 $speed = 8.5 Case 900 To 1050 $speed = 10.0 Case 1050 To 1300 $speed = 12.0 Case 1300 To 1700 $speed = 15.0 Case Else $speed = 20 EndSwitch ConsoleWrite("$speed=" & $speed & @CRLF) _IELoadWait($oIE) $iispeed = _IETagNameGetCollection($oIE, "strong", 1) $err = @error ConsoleWrite("252, @error=" & @error & @CRLF) If $err Then ent() $srrs = False Return EndIf _IELinkClickByIndex($oIE, 21) _IELinkClickByIndex($oIE, 20) $ostrongs = _IETagNameGetCollection($oIE, "strong", 4) if @error Then ConsoleWrite("260, @error=" & @error & @CRLF) Else ConsoleWrite("$ostrongs=" & $ostrongs.innertext & @CRLF) EndIf ConsoleWrite("$iispeed=" & $iispeed.innertext & @CRLF) If Not @error Then $iispeed = $iispeed.innertext If Number($iispeed) <> $speed Then If $iispeed == 64 Then $iispeed = 0 If $iispeed == 320 Then $iispeed = 0 If $iispeed > 320 Then $iispeed = 1 If $iispeed == "Макс." Then $iispeed = 20 $iispeed = Floor($iispeed) ConsoleWrite("$iispeed=" & $iispeed & @CRLF) $speed = Floor($speed) ConsoleWrite("$speed=" & $speed & @CRLF) If $iispeed < $speed Then _IELinkClickByIndex($oIE, 21) If $iispeed > $speed Then _IELinkClickByIndex($oIE, 20) If $iispeed = $speed Then _IELinkClickByIndex($oIE, 21) _IELinkClickByIndex($oIE, 20) EndIf While 1 Sleep(250) $ostrongs = _IETagNameGetCollection($oIE, "strong", 4) if not @error Then $ispeed = $ostrongs.innertext Else Sleep(1000) If $iispeed < $speed Then _IELinkClickByIndex($oIE, 21) If $iispeed > $speed Then _IELinkClickByIndex($oIE, 20) If $iispeed = $speed Then _IELinkClickByIndex($oIE, 21) _IELinkClickByIndex($oIE, 20) ContinueLoop EndIf EndIf If $ispeed == "Макс." Then $ispeed = 20 If $ispeed == 64 Then $ispeed = 0 If $ispeed == 320 Then $ispeed = 0 If $ispeed > 320 Then $ispeed = $ispeed / 1000 Else $ispeed = Floor($ispeed) EndIf $speed = Floor($speed) ConsoleWrite("$ispeed=" & $ispeed & @CRLF) If $ispeed < $speed Then _IELinkClickByIndex($oIE, 21) If $ispeed > $speed Then _IELinkClickByIndex($oIE, 20) If $ispeed = $speed Then Sleep(1000) _IELinkClickByIndex($oIE, 22) ConsoleWrite(@error & @CRLF) ExitLoop EndIf WEnd EndIf Else ConsoleWrite(@ScriptLineNumber & " err " & $err & @CRLF) EndIf Sleep(5000) $srrs = False EndIf EndFunc ;==>srrs Func enter() $obgn = _IEGetObjByName($oIE, "IDToken1") If @error Then ConsoleWrite("303 enter err - "& @error & @CRLF) Return EndIf $obgp = _IEGetObjByName($oIE, "IDToken2", 1) ConsoleWrite("307 enter err - "& @error & @CRLF) ;~ $obgs=_IEGetObjById($oIE, "doSubmitLoginForm") ;~ MsgBox(0,"",_IEFormElementGetValue($obgn)) _IEFormElementSetValue($obgn, "login") _IEFormElementSetValue($obgp, "Password") _IEImgClick($oIE, "white-button-arrow-right.png", "src") _IELoadWait($oIE, 1000, 450000) ConsoleWrite("314 enter loadwait err - "& @error & @CRLF) EndFunc ;==>enter ;~ MsgBox(0,"",_IEFormElementGetValue($obgp)) ;~ $oLinks = _IELinkGetCollection($oIE) ;~ $iNumLinks = @extended ;~ $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF ;~ $i = 0 ;~ For $oLink In $oLinks ;~ $sTxt &= $i & ", " & $oLink.href & ", " & $oLink.innertext & @CRLF ;~ $i+=1 ;~ Next ;~ MsgBox($MB_SYSTEMMODAL, "Link Info", $sTxt) _IELinkClickByIndex($oIE, 21) $ostrongs = _IETagNameGetCollection($oIE, "strong") ;~ $ostrongs[1].innertext ;~ подтвердить index - 17 ;~ кнопки минус плюс index - 20,21 ;~ скорость index 1,4 _IEQuit($oIE) ;~ $oLinks = _IELinkGetCollection($oIE) ;~ $iNumLinks = @extended ;~ $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF ;~ For $oLink In $oLinks ;~ $sTxt &= $oLink.href & @CRLF ;~ Next ;~ MsgBox($MB_SYSTEMMODAL, "Link Info", $sTxt) ;~ MsgBox(0,"",_IEBodyReadText($obg)) ;~ $oSubmit = _IEGetObjByName($oIE, "submitExample") ;~ _IEAction($oSubmit, "click") ;~ '<div class="speed"><strong>1.0</strong>' ;~ '<div class="decrease"><a class="icon" href="#"></a></div>' ;~ '<div class="increase"><a class="icon" href="#"></a></div>' Файл: исходник Снимок: ![]() История версий: Скрытый текст
10.0.0.3-исправлены критичные ошибки Источник: autoit-script.ru Автор(ы):svnkraft |
|
Отправлено: 18:57, 16-10-2016 |
Ветеран Сообщения: 27449
|
Профиль | Отправить PM | Цитировать svkraft, поправьте BBCode для миниатюры, и разместите её не внутри autoit-script.ru (куда всё равно требуется регистрация для её отображения), а на общедоступном хостинге изображений, таком как ImgUr или подобных.
|
Отправлено: 20:06, 16-10-2016 | #2 |
Для отключения данного рекламного блока вам необходимо зарегистрироваться или войти с учетной записью социальной сети. Если же вы забыли свой пароль на форуме, то воспользуйтесь данной ссылкой для восстановления пароля. |
![]() |
Участник сейчас на форуме |
![]() |
Участник вне форума |
![]() |
Автор темы |
![]() |
Сообщение прикреплено |
| |||||
Название темы | Автор | Информация о форуме | Ответов | Последнее сообщение | |
VBS/WSH/JS - СКРИПТ для - прикрепление сетевого принтера, а другой для удаленного удаления прогр. | morozov_s_v | Скриптовые языки администрирования Windows | 1 | 17-01-2014 06:45 | |
Любой язык - нужен скрипт для удаления всех файлов кроме нужных для запуска Windows XP | Dark Ange1 | Скриптовые языки администрирования Windows | 11 | 07-03-2010 13:34 | |
Скрипт для смены сочетания клавишь для переключения регистра | zegerman | Хочу все знать | 2 | 03-12-2009 08:06 | |
[решено] Нужен скрипт для autoit для раскопирования файла | irk72ag | Автоматическая установка приложений | 3 | 19-06-2009 15:27 | |
MSFT SQL Server - [решено] Преобразование скрипта для Oracle в скрипт для SQL | EvgeniyQQQ | Программирование и базы данных | 3 | 25-03-2009 01:26 |
|