Jump to content

See My Ping


markj
 Share

Recommended Posts

Right all you clever folk. I want to create a ping tool with a response box.

To kick me off i'd like to know how to do the following.

gui with a input box, button and label. You put an ip address in the input box, press the button and it pings the ip. The clever bit is how it shows the ping in the label box/status bar (which ever works best)

Answers on a postcard please :think: This will put me on the right track on a bigger project but i didnt want to be rude and ask for all the answers:

The gui code is here:

GuiCreate("MyGUI", 412, 469,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_1 = GuiCtrlCreateInput("", 190, 30, 150, 20)

$Button_2 = GuiCtrlCreateButton("PING", 40, 30, 130, 20)

$Label_3 = GuiCtrlCreateLabel("", 40, 80, 310, 350, $SS_SUNKEN)

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case Else

;;;

EndSelect

WEnd

Exit

Link to comment
Share on other sites

Mayb this works:

#include <GUICONSTANTS.AU3>
GuiCreate("MyGUI", 412, 469,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_1 = GuiCtrlCreateInput(@IPAddress1, 190, 30, 150, 20)
$Button_2 = GuiCtrlCreateButton("PING", 40, 30, 130, 20)
$Label_3 = GuiCtrlCreateLabel("", 40, 80, 310, 350, $SS_SUNKEN)

GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button_2
If GUICtrlRead($Input_1) = "" Then
MsgBox(0,"Error"," You need to write a ip in the input")
Else    
$ip=GUICtrlRead($Input_1)
$ping=Ping($ip) 
GUICtrlSetData($Label_3, "The ping at "&$ip&" has a ping at "&$ping)
EndIf
Case Else
;;;
EndSelect
WEnd
Exit
My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!
Link to comment
Share on other sites

requires beta:

#include <GUICONSTANTS.AU3>
#include <GuiEdit.au3>

GUICreate("MyGUI", 412, 469, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_1 = GUICtrlCreateInput(@IPAddress1, 190, 30, 150, 20)
$Button_2 = GUICtrlCreateButton("PING", 40, 30, 130, 20)
$edt_ping = GUICtrlCreateEdit("Ping Results" & @CRLF, 40, 80, 310, 350, BitOR($WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_MULTILINE, $ES_READONLY))

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_2
            If GUICtrlRead($Input_1) = "" Then
                MsgBox(0, "Error", " You need to write a ip in the input")
            Else
                $ip = GUICtrlRead($Input_1)
                $ping = Ping($ip)
                If @error Then
                    GUICtrlSetData($edt_ping, GUICtrlRead($edt_ping) & @CRLF & "Error pinging " & $ip)
                Else
                    GUICtrlSetData($edt_ping, GUICtrlRead($edt_ping) & @CRLF & "The ping at " & $ip & " has a ping at " & $ping)
                EndIf
                _GUICtrlEditLineScroll($edt_ping, 0, _GUICtrlEditGetLineCount($edt_ping))
            EndIf
        Case Else
        ;;;
    EndSelect
WEnd
Exit

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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