#include <Date.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $FilePath, $in_EMail, $ch_Week, $ch_Date, $ch_Messages, $DayName, $StartClickOn = 0, $wasonline = 0, $i=0, $iPaused = False Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Spy MA v 1", 215, 145, 288, 174,-1,$WS_EX_TOOLWINDOW) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseClick") $Label1 = GUICtrlCreateLabel("Введите E-Mail:", 8, 8, 81, 17) $in_EMail = GUICtrlCreateInput("somename@mail.ru", 96, 8, 105, 17) $Group1 = GUICtrlCreateGroup("Создавать файлы с именами ...", 8, 32, 185, 65) GUICtrlCreateGroup("", -99, -99, 1, 1) $ch_Week = GUICtrlCreateRadio("... дней недели", 16, 48, 97, 25) $ch_Date = GUICtrlCreateRadio("... даты", 16, 72, 73, 17) $ch_Messages = GUICtrlCreateCheckbox("Уведомлять о смене статуса", 16, 101, 169, 17) $bt_Start = GUICtrlCreateButton("Начать", 8, 125, 49, 17, 0) GUICtrlSetOnEvent(-1, "NewDay") $bt_Check = GUICtrlCreateButton("Проверить статус", 104, 125, 105, 17, 0) GUICtrlSetOnEvent(-1, "Info") GUISetState(@SW_SHOW) CheckSettings() While 1 Sleep(100) WEnd Func CloseClick () FileWrite($FilePath, @CRLF & "-------------------------------------" & @CRLF) SaveSettings() Exit EndFunc Func CheckSettings() If FileExists("Settings.ini") Then GUICtrlSetData ($in_EMail, IniRead("Settings.ini", "Settings", "E-Mail", "someone@mail.ru")) GUICtrlSetState ($ch_Week, IniRead("Settings.ini", "Settings", "Week", 4)) GUICtrlSetState ($ch_Date, IniRead("Settings.ini", "Settings", "Date", 4)) GUICtrlSetState ($ch_Messages, IniRead("Settings.ini", "Settings", "Messages", 4)) EndIf EndFunc Func SaveSettings () IniWrite ("Settings.ini", "Settings", "E-Mail", GUICtrlRead($in_EMail)) IniWrite ("Settings.ini", "Settings", "Week", GUICtrlRead($ch_Week)) IniWrite ("Settings.ini", "Settings", "Date", GUICtrlRead($ch_Date)) IniWrite ("Settings.ini", "Settings", "Messages", GUICtrlRead($ch_Messages)) EndFunc Func NewDay ($i) If $i = 1 Then FileWrite($FilePath, @CRLF & "-------------------------------------> [" & _NowCalc() & "] <-----Конец---" & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF) $i=0 FileClose($FilePath) EndIf If GUICtrlRead($ch_Week) = 1 Then $DayName = _DateDayOfWeek(@WDAY) If GUICtrlRead($ch_Date) = 1 Then $DayName = _NowDate() $FilePath = "Days/" & $DayName & ".txt" FileOpen($FilePath, 1 + 8) FileWrite($FilePath, "-------------------------------------> [" & _NowCalc() & "] <----Начало---" & @CRLF & @CRLF) $StartClickOn = 1 StartClick() EndFunc Func CalcTime ($start, $end) $seconds = _DateDiff("s", $start, $end) $minuts = 0 $hours = 0 While $seconds > 60 $seconds = $seconds - 60 $minuts = $minuts + 1 If $minuts >= 60 Then $hours = $hours + 1 $minuts = 0 EndIf WEnd Return $hours & ":" & $minuts & ":" & $seconds EndFunc Func StartClick () if $StartClickOn = 0 Then NewDay () While $DayName = _NowDate() Or $DayName = _DateDayOfWeek(@WDAY) Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE FileWrite($FilePath, @CRLF & "-------------------------------------" & @CRLF) SaveSettings() Exit Case $bt_Check Info() EndSwitch $size = InetGetSize("http://status.mail.ru/?" & GUICtrlRead($in_EMail)) If (($size = 349) Or ($size = 568)) And $wasonline = 0 Then If GUICtrlRead($ch_Messages) = 1 Then Info () $wasonline = 1 $timeonline = _NowTime() $fulltimeonline = _NowCalc() EndIf If $size = 570 And $wasonline = 1 Then If GUICtrlRead($ch_Messages) = 1 Then Info () $timeoffline = _NowTime() $fulltimeoffline = _NowCalc() FileWrite($FilePath, $timeonline & " - " & $timeoffline & " (" & CalcTime($fulltimeonline, $fulltimeoffline) & ")" & @CRLF) $wasonline = 0 EndIf Sleep(100) $StartClickOn = 1 WEnd FileClose($FilePath) NewDay(1) EndFunc Func Info () $size = InetGetSize("http://status.mail.ru/?" & GUICtrlRead($in_EMail)) $status = "Нет в сети" If $size = 349 or $size = 568 Then $status = "В сети" TrayTip(GUICtrlRead($in_EMail), $status, 2, 1) EndFunc |