ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Coding Snacks

[REQUEST] Review "Mr. Ping"

(1/2) > >>

robcull:
Hey
 
i just made this coding snack in autoit for someone... somewhere. Upon completing it i've realized that I don't remember who it was for.

Therefore, i've decided to post the prelim "proto" script for you all to test, use, and (hopefully) review. I am looking for an alternate way of announcing messages to the user other than the tray balloons and the message boxes, but it's a start.

**update: I replaced the message boxes that tell you when a test failed and it is moving onto a different test, and the tray balloons that say the latency, with upper-right screen corner spash text. much nicer. try it out.

Description:

It starts out pinging google, and displays the latency in a splash**. If there is no connection, Mr. Ping will tell you that it failed and it will try a different site.

If that succeeds, then it will continue pinging every 6 seconds or so, and telling you the latency just the same as before. If it fails, then it does the same thing, but tries a different site.

It goes through a total of 4 websites. After all 4 of them fail, it will try to ping the localhost address (127.0.0.1).
-If successful, then it tells you the latency in **splash and in another **splash it tells you that it succeeded and you should check your connection/settings. Then it restarts in 10 seconds.
-If localhost fails, it tells you in a msgbox, and then gives its suggestions (hardware/driver problem), gives salutations, and exits.

The websites it cycles through (in order) are google, yahoo, donationcoder, and wikipedia. Then localhost of course.

.exe attached, here's the source:


--- ---
splashtexton ( "Mr. Ping", "Hi! My name is Mr. Ping. I'll help you test your connection to the internets.", 500, 60, -1, -1, 1, -1, 20, 700)
sleep (5000)
SplashOff()
splashtexton ( "Mr. Ping", "Starting....", 140, 30, -1, -1, 1, -1, 20, 700)
sleep (500)
SplashOff()

While 1

Do
sleep (1000)
$var = Ping ("www.google.com", 1000)
if $var then
splashtexton ( "Status", " I pinged Google in " & $var, 120, 16, 5, 5, 5, -1, 8, 450)
sleep (6000)
endif
until $var = 0

splashtexton ("Connection Problem", " I couldn't reach Google. I'll try Yahoo!...    Error number: " & @error, 240, 40, 5, 5, 1, -1, 10, 550)
sleep (3500)
SplashOff()

Do
sleep (1000)
$var = Ping ("www.yahoo.com", 1000)
if $var then
splashtexton ( "Status", " I pinged Yahoo! in " & $var, 120, 16, 5, 5, 5, -1, 8, 450)
sleep (6000)
endif
until $var = 0

splashtexton ("Connection Problem", " I couldn't reach Yahoo!. I'll try DonationCoder...    Error number: " & @error, 285, 40, 5, 5, 1, -1, 10, 550)
sleep (3500)
SplashOff()

Do
sleep (1000)
$var = Ping ("www.DonationCoder.com", 1000)
if $var then
splashtexton ( "Status", " I pinged DonationCoder in " & $var, 150, 16, 5, 5, 5, -1, 8, 450)
sleep (6000)
endif
until $var = 0

splashtexton ("Connection Problem", " I couldn't reach DonationCoder. I'll try Wikipedia...    Error number: " & @error, 300, 40, 5, 5, 1, -1, 10, 550)
sleep (3500)
SplashOff()

Do
sleep (1000)
$var = Ping ("www.wikipedia.org", 1000)
if $var then
splashtexton ( "Status", " I pinged Wikipedia in " & $var, 130, 16, 5, 5, 5, -1, 8, 450)
sleep (6000)
endif
until $var = 0

splashtexton ("Connection Problem", " I couldn't reach Wikipedia. I'll try the localhost (172.0.0.1)...    Error number: " & @error, 350, 40, 5, 5, 1, -1, 10, 550)
sleep (3500)
SplashOff()

sleep (1000)
$var = Ping ("127.0.0.1", 1000)

if $var then
splashtexton ( "Status", " I pinged the localhost in " & $var, 135, 16, 5, 5, 5, -1, 8, 450)
sleep (2000)
splashtexton ("Status", "I successfully pinged the localhost (127.0.0.1). Check your connection and/or connection settings. I'll restart the test in 10 seconds.", 440, 35, 5, 5, 1, -1, 10, 550)
sleep (10000)
SplashOff()
elseif $var = 0 Then
Msgbox (48, "Connection Problem", "I couldn't ping the localhost! Check for hardware/driver problems. That's as much as I can do for now... ping you later!")
Exit
endif

Wend

mouser:
neat idea.

robcull:
thx. i just updated it so now it's much smoother and nicer than before.

freewareking101:
I wish its a powerbuilder code so I can understand it.. heheheh

Conquer:

--- ---If ConnectedToInternet()
{
   Msgbox, An internet connection is currently detected.`nPress OK to exit the program.
   ExitApp
}
Else
{
   Msgbox, An internet connection was not detected.`nPress OK to exit the program.
   ExitApp
}

ConnectedToInternet(flag=0x43) {
Return DllCall("Wininet.dll\InternetGetConnectedState", Str,flag, Int,0 )
}

Navigation

[0] Message Index

[#] Next page

Go to full version