topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday December 14, 2024, 4:18 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: [REQUEST] Review "Mr. Ping"  (Read 12201 times)

robcull

  • Participant
  • Joined in 2008
  • *
  • Posts: 3
    • View Profile
    • Donate to Member
[REQUEST] Review "Mr. Ping"
« on: September 12, 2008, 12:17 AM »
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

« Last Edit: September 12, 2008, 01:49 AM by robcull »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Review Request: Mr. Ping
« Reply #1 on: September 12, 2008, 12:24 AM »
neat idea.

robcull

  • Participant
  • Joined in 2008
  • *
  • Posts: 3
    • View Profile
    • Donate to Member
Re: Review Request: Mr. Ping
« Reply #2 on: September 12, 2008, 01:29 AM »
thx. i just updated it so now it's much smoother and nicer than before.

freewareking101

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 3
    • View Profile
    • Donate to Member
Re: [REQUEST] Review "Mr. Ping"
« Reply #3 on: November 08, 2008, 03:29 AM »
I wish its a powerbuilder code so I can understand it.. heheheh

Conquer

  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 50
    • View Profile
    • Donate to Member
Re: [REQUEST] Review "Mr. Ping"
« Reply #4 on: December 05, 2008, 01:48 PM »
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 )
}

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: [REQUEST] Review "Mr. Ping"
« Reply #5 on: December 05, 2008, 10:40 PM »
Pinging localhost should always work, whether you have a network adapter installed or not - just saying :)
- carpe noctem

robcull

  • Participant
  • Joined in 2008
  • *
  • Posts: 3
    • View Profile
    • Donate to Member
Re: [REQUEST] Review "Mr. Ping"
« Reply #6 on: January 04, 2009, 07:06 PM »
Pinging localhost should always work, whether you have a network adapter installed or not - just saying :)

Not necessarily. If you do not have a network adapter installed, or if it is damaged significantly, the localhost address will not reply. While it is highly unlikely that this would be the case (in all my years of experience, i've only encountered one instance where i could not ping the localhost due to a damaged NIC), i felt it necessary, since it is proper trouble shooting.