#include <IE.au3>
#include <Constants.au3>
#include <Encoding.au3>
Opt('TrayMenuMode', 1)
HotKeySet('{Esc}', '_Exit')
$iPause = Random(300, 600, 1)
$iStart = TimerInit()
$iCount = 0
While 1
If TimerDiff($iStart) > $iPause * 1000 Then
ConsoleWrite('iPause: ' & $iPause & @CR)
_Connect()
If Not @error Then
ConsoleWrite('IP: ' & @IPAddress1 & @CR)
_Click()
If Not @error Then
$iCount += 1
ToolTip('Кликов сделано: ' & $iCount, 0, 0)
EndIf
_Disconnect()
Else
ConsoleWrite('Error Connect' & @CR)
EndIf
$iStart = TimerInit()
$iPause = Random(300, 600, 1)
EndIf
Sleep(100)
WEnd
Func _Click()
Local $oIE, $sUrl = 'http://autoit-script.ru/index.php?topic=5083', _
$sLinkText = 'сюда кликать', $hWin
$oIE = _IECreate($sUrl)
If @error Then Return SetError(1)
_IELinkClickByText($oIE, $sLinkText)
If @error Then
_IEQuit($oIE)
Return SetError(1)
Else
_IEQuit($oIE)
$hWin = WinWait('[TITLE:InternetMap.Info;CLASS:IEFrame]', '', 10)
If $hWin Then
Sleep(5000)
WinClose($hWin)
Return SetError(0)
Else
Return SetError(1)
EndIf
EndIf
EndFunc ;==>_Click
Func _Connect()
Local $s_Read, $i_PID, $s_ConnectName = 'Avangard DSL Connection', $s_LogPass = 'ptn'
$i_PID = Run('rasdial "' & $s_ConnectName & '" ' & $s_LogPass & ' ' & $s_LogPass, '', _
@SW_HIDE, $STDOUT_CHILD)
If Not $i_PID Then Return SetError(1)
While 1
$s_Read &= StdoutRead($i_PID)
If @error Then ExitLoop
Sleep(20)
WEnd
$s_Read = _Encoding_866To1251($s_Read)
ConsoleWrite('_Connect: ' & $s_Read & @CR)
If StringInStr($s_Read, 'Установлена связь') Then
Return SetError(0)
Else
Return SetError(1)
EndIf
EndFunc ;==>_Connect
Func _Disconnect()
Local $s_Read, $i_PID, $s_ConnectName = 'Avangard DSL Connection'
$i_PID = Run('rasdial "' & $s_ConnectName & '" /disconnect', '', @SW_HIDE, $STDOUT_CHILD)
If Not $i_PID Then Return SetError(1)
While 1
$s_Read &= StdoutRead($i_PID)
If @error Then ExitLoop
Sleep(20)
WEnd
$s_Read = _Encoding_866To1251($s_Read)
ConsoleWrite('_Disconnect: ' & $s_Read & @CR)
If StringInStr($s_Read, 'успешно') Then
Return SetError(0)
Else
Return SetError(1)
EndIf
EndFunc ;==>_Disconnect
Func _Exit()
If ProcessExists('IEXPLORE.EXE') Then
ProcessClose('IEXPLORE.EXE')
EndIf
MsgBox(64, 'Info', 'Кликов сделано: ' & $iCount)
Exit
EndFunc ;==>_Exit