- - Jak skonfigurować alerty łączności internetowej w systemie Windows 10

Jak skonfigurować alerty łączności internetowej w systemie Windows 10

Jeśli twój internet działa i musiszśledź, czy masz połączenie, czy nie, najprostszym sposobem jest obserwowanie symbolu WiFi w zasobniku systemowym w systemie Windows 10. Po utracie połączenia z Internetem na symbolu WiFi pojawia się żółty wykrzyknik. Możesz także pingować stronę internetową. Jeśli nie możesz mieć dostępu do zasobnika systemowego, a pingowanie wydaje Ci się uciążliwe, możesz skonfigurować dźwiękowe powiadomienia o połączeniach internetowych w systemie Windows 10 za pomocą prostego skryptu.

ALARM SPOILERA: Przewiń w dół i obejrzyj samouczek wideo na końcu tego artykułu.

Alerty łączności z Internetem

Ten skrypt został pierwotnie napisany przez SuperuserFabby i ulepszony przez VMMF. Skrypt wymaga pobrania bezpłatnego narzędzia o nazwie Narzędzia GNU dla Win32. Wyodrębnij go i poszukaj w następującym folderze pliku EXE o nazwie Sleep.exe.

UnxUtilsusrlocalwbin

Zostanie to wykorzystane do dodania czasu oczekiwania między czekami. Ten plik EXE powinien znajdować się w tym samym folderze, w którym zapisano skrypt. Nie potrzebujesz nic więcej, więc możesz to usunąć.

Otwórz Notatnik i wklej w nim następujące elementy. Zapisz go z rozszerzeniem CMD i uruchom plik. Plik sound.vbs zostanie utworzony przez skrypt, więc nie martw się o to.

@ECHO OFF
:whileNoInternet
set "host=8.8.8.8"
::check if internet is working
PING -n 1 -w 5000 "%host%" | findstr /r /c:"[0-9] *ms"
if %errorlevel% neq 0 (
::the internet is not working keep cheking until it does
echo No internet yet %TIME%
GOTO whileNoInternet
)
echo we gained internet
::the internet is working play internet ON song
@echo off
set "file=InternetON_GOGOGO.mp3"
( echo Set Sound = CreateObject("WMPlayer.OCX.7"^)
echo Sound.URL = "%file%"
echo Sound.Controls.play
echo do while Sound.currentmedia.duration = 0
echo wscript.sleep 100
echo loop
echo wscript.sleep (int(Sound.currentmedia.duration^)+1^)*1000) >sound.vbs
start /min sound.vbs
@ECHO OFF
:whileInternet
sleep.exe 5s
::check if internet is still working
PING -n 1 -w 1000 "%host%" | findstr /r /c:"[0-9] *ms"
if %errorlevel% == 0 (
::the internet is still working keep cheking until it does not
echo We have internet %TIME%
GOTO whileInternet
)
:: detect possible internet glitches (do not trust the first failure)
echo internet glitch detected
sleep.exe 10s
PING -n 1 -w 1000 "%host%" | findstr /r /c:"[0-9] *ms"
if %errorlevel% == 0 (
::the internet is still working keep cheking until it does not
echo We have internet %TIME%
GOTO whileInternet
)
:: if it failed twice in a row most likely internet is down
echo we lost internet
::the internet is not working anymore, play internet OFF song
@echo off
set "file=InternetHasFallen.mp3"
( echo Set Sound = CreateObject("WMPlayer.OCX.7"^)
echo Sound.URL = "%file%"
echo Sound.Controls.play
echo do while Sound.currentmedia.duration = 0
echo wscript.sleep 100
echo loop
echo wscript.sleep (int(Sound.currentmedia.duration^)+1^)*1000) >sound.vbs
start /min sound.vbs
::start monitoring if it comes back
GOTO whileNoInternet

To wszystko, co musisz zrobić. Okno wiersza polecenia pozostanie otwarte, sprawdzając stan połączenia internetowego. Jeśli się zmieni, usłyszysz dźwięk wyłączenia.

Komentarze