Jump to content

Pinger


LimeSeed
 Share

Recommended Posts

#NoTrayIcon
#include <guiconstants.au3>
#Include <GuiEdit.au3>
#include <WindowsConstants.au3>

guicreate("Ping", 170, 50)
$input = guictrlcreateinput("ip address", 5, 5, 100, 20)
$pingnumber = GuiCtrlCreateInput("1", 110, 5, 55, 20)
$updown = GuiCtrlCreateUpDown($pingnumber)
guictrlsetlimit($updown, 10000, 1)
$ping = guictrlcreatebutton("Ping", 5, 27, 100, 20)
$pinged = 0
$numberoftimespinged = guictrlcreatelabel($pinged, 110, 30, 20, 20)
$he = guictrlcreatebutton("?", 145, 28, 20, 20)
guisetstate(@SW_SHOW)

While 1
 $msg = guigetmsg()
 
 Select
 case($msg = -3)
  Exit
 case ($msg = $he)
  $van = ping("cocks", 200)
  if @error = 0 Then
   msgbox(0, "Ping", "You Are Connected To The Internet")
  Else
   msgbox(0, "Ping", "You Are Not Connected To The Internet")
  EndIf
 case($msg = $ping)
  $adress = guictrlread($input)
  if $adress = "ip address" Then
   msgbox(0, "Ping", "Error!"  & @CRLF & "Please Enter A Real Ip Adress Or Hostname")
  Else
   $pingread = guictrlread($pingnumber)
   for $1 = 0 to $pingread step 1
   $var = ping($adress, 200)
   sleep(3)
   $pinged += 1
   guictrlsetdata($numberoftimespinged, $pinged)
  Next
   $pinged = 0
   guictrlsetdata($numberoftimespinged, $pinged)
   if @error = 1 Then
    msgbox(0, "Ping", "The Host " & $adress & " Is Offline")
   elseif @error = 2 Then
    msgbox(0, "Ping", "The Host " & $adress & " Is Unreachable")
   elseif @error = 3 Then
    msgbox(0, "Ping", "Bad Destination")
   elseif @error = 4 Then
    msgbox(0, "Ping", "The Host " & $adress & " Could Not Be Reached.")
   Elseif @error = 0 Then
    msgbox(0, "Ping", "Reply From " & $adress & " In " & $var & " Milliseconds.")
   EndIf
  
  EndIf
 EndSelect
WEnd

Edited by LimeSeed
global $warming = true
Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...

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...