Jump to content

NÁVOD: Stav připojení k internetu každých 30s


Guest DCG
Go to solution Solved by Guest DCG,

Recommended Posts

  • Solution

Jednoduchý skript, který každých 30 sekund zkontroluje, zda jste připojeni k internetu (pingem na adresu google.com). Skript bude automaticky startovat po přihlášení do Windows. V souboru offline.txt najdete datum a čas, kdy nebylo možné se připojit k internetu.

 

Co budete potřebovat:

AutoHotkey (Windows): https://www.autohotkey.com/

 

Návod:

1.) Nainstalujte AutoHotkey

2.) Vytvořte novou složku ahk  v adresáři C:\Users\NAZEV_UZIVATELE\Documents

3.) V adresáři vytvořte nový soubor offline.txt

4.) Do souboru offline.txt vložte následující kod:

Loop
{
    speed:=SimplePing("google.com")
    SimplePing(URL)
    {
        Runwait,%comspec% /c ping -w 4000 -n 1 %url%>ping.log,,hide
        fileread, StrTemp, ping.log
        if RegExMatch(StrTemp, "Average = (\d+)"){
      
        Sleep, 30000

        }else{
        
        FileAppend, %A_YYYY%-%A_MM%-%A_DD% %A_Hour%:%A_Min%:%A_Sec%`n, C:\Users\NAZEV_UZIVATELE\Documents\ahk\offline.txt

        Sleep, 30000

        }
    }

}

5.) Změnte NAZEV_UZIVATELE za vaše uživatelské jméno

6.) Přejmenujte soubor offline.txt na offline.ahk

7.) V adresáři vytvořte prázdný soubor offline.txt

8.) Klepněte pravým tlačítkem na soubor offline.ahk . Vyberte Send  >>  Desktop (create shortcut)

9.) Jděte do adresáře C:\Users\NAZEV_UZIVATELE\Desktop

10.) Zkopírujte soubor offline.ahk - Shortcut do adresáře C:\Users\NAZEV_UZIVATELE\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

 

Alternativou je rozšíření Internet Connection Monitor pro Chrome prohlížeč.

https://chrome.google.com/webstore/detail/internet-connection-monit/hgccfdagfbilbdbkgmfdmmdfmjjoakfo/related

https://chrome.google.com/webstore/detail/internet-connection-monit/hgccfdagfbilbdbkgmfdmmdfmjjoakfo

Edited by DCG
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...