Last active
December 11, 2015 21:38
-
-
Save jNizM/4663294 to your computer and use it in GitHub Desktop.
[AU3] Ping with log & traytip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Global $Online = False, $IP = 'www.google.de', $Intervall = 5, $Log_Path = @ScriptDir&'\'&$IP&'.txt' | |
While 1 | |
$Timer = TimerInit() | |
$Ping = Ping($IP) | |
If $Ping > 0 Then | |
If $Online = False Then | |
$Online = True | |
FileWrite($Log_Path,'[ '&@MDAY&'/'&@MON&'/'&@YEAR&' | '&@HOUR&':'&@MIN&':'&@SEC&' ] '&$IP&' is online now!'&@CRLF) | |
;TrayTip('',$IP&' is online now!',10,1) | |
;MsgBox(8192+64, "Online", $IP&' is online now!') | |
EndIf | |
Else | |
If $Online = True Then | |
$Online = False | |
FileWrite($Log_Path,'[ '&@MDAY&'/'&@MON&'/'&@YEAR&' | '&@HOUR&':'&@MIN&':'&@SEC&' ] '&$IP&' is offline now!'&@CRLF) | |
;TrayTip('',$IP&' is offline now!',10,2) | |
;MsgBox(8192+48, "Offline", $IP&' is offline now!') | |
EndIf | |
EndIf | |
Do | |
Sleep(1000) | |
Until TimerDiff($Timer) >= ($Intervall*1000) | |
WEnd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment