Jump to content

Nice simple internet checker


Achilles
 Share

Recommended Posts

Check my little prog out XD.

It's more a nice GUI but in German srry:)

#Include <GUIconstants.au3>
#Include <XSkin.au3>
#Include <misc.au3>
#Include <_ButtonHover.au3>
$Skin_Folder = @ScriptDir & "\Skins\Carbon"
$XButton_Location = @ScriptDir & "\Buttons\Style_15b"
$XSkinGui =  XSkinGUICreate("Rofl", 301, 177, $Skin_Folder)
$button_1 = _HoverButton("Ping Testen", 85, 54, 110, 37, 0x40e0d0)
$TextBox = GUICtrlCreateInput("",85,111,118,20)
$fr = FileRead("web.txt")
GUICtrlSetData($TextBox,$fr)
$button_2 = _HoverButton("Ciao", 229, 111, 52, 22, 0x40e0d0)
$menu = GUICtrlCreateMenu("Datei")
$item = GUICtrlCreateMenuitem("Adresse Speichern", $menu)
$fontmenu = GUICtrlCreateMenu("Hilfe")
$help = GUICtrlCreateMenuitem("Hilfe", $fontmenu)
$Inf = GUICtrlCreateMenuitem("Info", $fontmenu)


    

;---------Case funktions...-----------------------------------------------------------
GUISetState()


While 1
    
$msg = GUIgetmsg()

    
MouseOver()
_CheckHoverAndPressed($XSkinGui)

select      
    Case $msg = $button_1
        $Page = FileRead("web.txt")
If Ping ($Page,"2000") Then MsgBox(64,"Nice","Du hast eine Verbindung zum Internet.")
If @error <> 0 then MsgBox(16,"error","Entweder du hast kein Internet oder Die seite gibt es nicht !")

Case $msg = $item
    MsgBox(64,"Ping-One","Alte Adresse gelöscht!")
        MsgBox(64,"Ping-One","Neue Adresse wurde geschpeichert!")
If FileExists("web.txt") then FileDelete("web.txt")
        $output=GuiCtrlRead($TextBox)
        FileWrite("web.txt",$output)
        
    Case $msg = $button_2
    exit    



Case $msg = $help
    MsgBox(64,"Ping-One","1.Schreibe eine http Adresse in die Textbox z.b(www.hallo.de)" & @CRLF & "2.Gehe auf Datei ---> Adresse Speichern." & @CRLF & "3.Drücke Ping Testen" & @CRLF & "" & @CRLF & "%%%%Have Fun%%%%%" & @CRLF & "your coder lim3s--->lim3sGER")
Case $msg = $Inf
    MsgBox(64,"Ping-One","This was made------>es wurde Programmiert von" & @CRLF & "------->lim3s" & @CRLF & "---->lim3s" & @CRLF & "------->oder auch" & @CRLF & "---->Guini" & @CRLF & "" & @CRLF & "%%%%Have Fun%%%% XD  noob, boon, flamer , cheater , dü ,dü ,dü ,du%%%%%")

;--------------------Funcs by lim3s------------

Endselect
Wend
Exit
Link to comment
Share on other sites

  • 4 weeks later...

Hey I made this 'cause my internet keeps going on and off and I decided to make a program to tell me when it's on or off. I have one question about it though: How could I stop it from saying internet access is disabled when the user is just using all their connection. For example I was downloading a video and opening a couple windows at the same time and it said the internet connection was disabled.

$ping = Ping("www.google.ca")
If $ping > 0 then 
    $internet = True 
    Msgbox(64, "Internet connection active!", "You internet connection is enabled...")
Else 
    $internet = False 
    Msgbox(16, "Internet connection failure!", "You internet connection is disabled...")
EndIf 

While 1 
    $ping = Ping("www.google.ca")
    If $ping = 0 and $internet = True then 
        Msgbox(16, "Internet connection failure!", "You internet connection is disabled...")
        $internet = False 
    ElseIf $ping > 0 and $internet = False Then
        Msgbox(64, "Internet connection active!", "You internet connection is enabled...")
        $internet = True
    EndIf 
    Sleep(1000)
Wend

Simple but useful (at least for me)

Probably would be more reliable if you had 3 or 4 URLs In an array instead of just www.google.ca

Then Loop through the array with Ping

If any of them test good then you have a connection so exit the loop

My reasoning is that a server could just be offline but the odds of all the servers in your array being offline at the same time are mighty slim.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Check this!!!

$state=-1

While 1
    $Con=_IsCon()
    If $Con<>$state Then
        If $Con=1 Then
            TrayTip("Internet Check","Connected",1,1)
            $state=1
        Else
            TrayTip("Internet Check","Not Connected",1,3)
            $state=0
        EndIf
    Else
    EndIf
WEnd

Func _IsCon()
    Return InetGet("http://www.mozilla.org", @TempDir&"\foo.html",1)
EndFunc

Short, Simple, Works!!! :whistle:

good! I use this, It's always work fine.

my UDF:myReplaceStringInFile suport StringRegExp and subdirectorymyFileListToArray suport StringRegExp and subdirectorymyImageIdentify get all information from image, use Image Magick com supportautoit in Chinaautoit 论坛yidabu成功社区

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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