markj Posted April 11, 2006 Share Posted April 11, 2006 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 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 ;;; EndSelectWEndExit Link to comment Share on other sites More sharing options...
rambo3889 Posted April 11, 2006 Share Posted April 11, 2006 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! youre the best in town Fight! Link to comment Share on other sites More sharing options...
markj Posted April 11, 2006 Author Share Posted April 11, 2006 I see where your going with that, but the main thing would be to show that the ping was succesful or not and to append to the label with all new pings or other commands? Link to comment Share on other sites More sharing options...
GaryFrost Posted April 11, 2006 Share Posted April 11, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now