rikho Posted January 18, 2008 Posted January 18, 2008 (edited) Hello all, i try to make a ping interface with a visual result. First of all i dont know how to code this my first test is bellow, i want to do appear the GUI to make the server choice Actually, the server ping is launch first and the GUI appear only next sorry for my noobs question, i need help to learn to code. thx for help. #include <GUIConstants.au3> $sbgui = GUICreate("GUI ping test", 351, 191, 340, 110) $Label1 = GUICtrlCreateLabel("Select target server", 8, 8, 139, 17) $Combo1 = GUICtrlCreateCombo("", 176, 8, 153, 120) GUICtrlSetData(-1, "server1|server2") GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $ServerName = $Combo1 MsgBox(4096, "", $ServerName, 0) $var = Ping($ServerName, 250) If $var Then; also possible: If @error = 0 Then ... MsgBox(0, "Status", "Serveur is responding") Else MsgBox(0, "Status", "Serveur is not responding") EndIf GUICtrlSetFont(-1, 10, 400, 0, "Arial") $MenuItem1 = GUICtrlCreateMenu("&File") $MenuItem2 = GUICtrlCreateMenu("&help") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited January 18, 2008 by rikho
kris06 Posted January 18, 2008 Posted January 18, 2008 Hello all, i try to make a ping interface with a visual result. First of all i dont know how to code this my first test is bellow, i want to do appear the GUI to make the server choice Actually, the server ping is launch first and the GUI appear only next sorry for my noobs question, i need help to learn to code. thx for help. #include <GUIConstants.au3> $sbgui = GUICreate("GUI ping test", 351, 191, 340, 110) $Label1 = GUICtrlCreateLabel("Select target server", 8, 8, 139, 17) $Combo1 = GUICtrlCreateCombo("", 176, 8, 153, 120) GUICtrlSetData(-1, "server1|server2") GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $ServerName = $Combo1 MsgBox(4096, "", $ServerName, 0) $var = Ping($ServerName, 250) If $var Then; also possible: If @error = 0 Then ... MsgBox(0, "Status", "Serveur is responding") Else MsgBox(0, "Status", "Serveur is not responding") EndIf GUICtrlSetFont(-1, 10, 400, 0, "Arial") $MenuItem1 = GUICtrlCreateMenu("&File") $MenuItem2 = GUICtrlCreateMenu("&help") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Hope this helps !! remember, you cannot read a value directly used in a GUI container. GUICtrlRead will help u acheive that. Rgds, kris expandcollapse popup#include <GUIConstants.au3> $sbgui = GUICreate("GUI ping test", 351, 191, 340, 110) $Label1 = GUICtrlCreateLabel("Select target server", 8, 8, 139, 17) $Combo1 = GUICtrlCreateCombo("", 176, 8, 153, 120) GUICtrlSetData(-1, "Server1|Server2"); Replace with the actual IP addr or FQDN GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $pingbutton=GUICtrlCreateButton("Ping", 110, 140, 100) $ServerName = $Combo1 GUICtrlSetFont(-1, 10, 400, 0, "Arial") $MenuItem1 = GUICtrlCreateMenu("&File") $MenuItem2 = GUICtrlCreateMenu("&help") GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE Exit Case $Msg = $pingbutton; On click event button, pingbutton MsgBox(4096, "Server Selected", GUICtrlRead($ServerName), 20) $var = Ping(GUICtrlRead($ServerName), 250) If $var Then; also possible: If @error = 0 Then ... MsgBox(0, "Status", "Server online. RS delay: " & $var) Else MsgBox(0, "Status", "Server is offline. Error Code: " & @error) EndIf EndSelect WEnd
rikho Posted January 18, 2008 Author Posted January 18, 2008 Hope this helps !! remember, you cannot read a value directly used in a GUI container. GUICtrlRead will help u acheive that. Rgds, kris expandcollapse popup#include <GUIConstants.au3> $sbgui = GUICreate("GUI ping test", 351, 191, 340, 110) $Label1 = GUICtrlCreateLabel("Select target server", 8, 8, 139, 17) $Combo1 = GUICtrlCreateCombo("", 176, 8, 153, 120) GUICtrlSetData(-1, "Server1|Server2"); Replace with the actual IP addr or FQDN GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $pingbutton=GUICtrlCreateButton("Ping", 110, 140, 100) $ServerName = $Combo1 GUICtrlSetFont(-1, 10, 400, 0, "Arial") $MenuItem1 = GUICtrlCreateMenu("&File") $MenuItem2 = GUICtrlCreateMenu("&help") GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE Exit Case $Msg = $pingbutton; On click event button, pingbutton MsgBox(4096, "Server Selected", GUICtrlRead($ServerName), 20) $var = Ping(GUICtrlRead($ServerName), 250) If $var Then; also possible: If @error = 0 Then ... MsgBox(0, "Status", "Server online. RS delay: " & $var) Else MsgBox(0, "Status", "Server is offline. Error Code: " & @error) EndIf EndSelect WEnd Thank you ! ps : i will remember
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