Skip to content

Instantly share code, notes, and snippets.

@jNizM
Last active December 11, 2015 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jNizM/4663294 to your computer and use it in GitHub Desktop.
Save jNizM/4663294 to your computer and use it in GitHub Desktop.
[AU3] Ping with log & traytip
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