GtHoo Posted March 22, 2012 Share Posted March 22, 2012 Hi, i can't get my ping script to work. Can someone help me? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Pinger", 200, 100) ; Lager viduet. $start = GUICtrlCreateButton("ping", 70, 70, 70) ;Lager knappen. GUICtrlCreateLabel ("Ping adressen:", 20, 10) ; Lager en label $url = GUICtrlCreateInput (" ", 20, 30, 150) GUISetState(@SW_SHOW) ; Gjør så vinduet ikke lukker seg. While 1 $msg = GUIGetMsg() Select Case $msg = $start ;gjør så "Vinduet" sine knapper skal fungere Local $ping = ping ("$url", 250) If $ping Then MsgBox(0, "Ping", "Pingen er " & $ping) Else MsgBox(0, "Error", "error", @error) EndIf Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Link to comment Share on other sites More sharing options...
ZacUSNYR Posted March 22, 2012 Share Posted March 22, 2012 No point in declaring it local since it'll be in the global scope. Although that has no effect on the script. Just a good FYI.. Local $ping = ping ("$url", 250) Replace that with $ping = ping (GUICtrlRead($url), 250) You need to read the input which is what GUICtrlRead does. Link to comment Share on other sites More sharing options...
GtHoo Posted March 22, 2012 Author Share Posted March 22, 2012 I have edited it like you did say, but I still can't get it to work. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Pinger", 200, 100) ; Lager viduet. $start = GUICtrlCreateButton("ping", 70, 70, 70) ;Lager knappen. GUICtrlCreateLabel ("Ping adressen:", 20, 10) ; Lager en label $url = GUICtrlCreateInput (" ", 20, 30, 150) GUISetState(@SW_SHOW) ; Gjør så vinduet ikke lukker seg. While 1 $msg = GUIGetMsg() Select Case $msg = $start ;gjør så "Vinduet" sine knapper skal fungere Global $ping = ping (GUICtrlRead ($url), 250) If $ping Then MsgBox(0, "Ping", "Pingen er " & $ping) Else MsgBox(0, "Error", "error", @error) EndIf Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Link to comment Share on other sites More sharing options...
qsek Posted March 22, 2012 Share Posted March 22, 2012 what address are you pinging? maybe remove the www and look for unwanted characters Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite Link to comment Share on other sites More sharing options...
GtHoo Posted March 22, 2012 Author Share Posted March 22, 2012 what address are you pinging? maybe remove the www and look for unwanted charactersI was trying google.com, facebook.com and some other sites, but it works now.It works with www.Thank you for the help Link to comment Share on other sites More sharing options...
ZacUSNYR Posted March 22, 2012 Share Posted March 22, 2012 I'm guessing your issue was the blank in the Input? I tested what you had posted and I was clicking in the input field, nothing worked. Because there was a leading blank created by the line $url = GUICtrlCreateInput (" ", 20, 30, 150) Brought up the GUI - back spaced after clicking - worked. Changing that to $url = GUICtrlCreateInput ("", 20, 30, 150) Solved that issue. 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