Possessed Posted March 5, 2007 Share Posted March 5, 2007 Hello all again i am having some problems. I am trying to make a simple output dialog that outputs my ping when i press the button. also i will be adding more funcs as i go along to output to this dialog. And yes my code is very messy so please no flaming . anyways hope someone can help me thanks peace.c expandcollapse popup;GUI stuff #include <GUIConstants.au3> GUISetOnEvent($GUI_EVENT_CLOSE, "Special") GUICreate("Possessed Portal",300,480) GUISetState (@SW_SHOW) GUISetBkColor (0x000000) $output = GUICtrlCreateEdit('**************************Console V1.0**************************'&@CRLF, 0,230, 300,200,$ES_AUTOVSCROLL+$WS_VSCROLL+$ES_READONLY, $WS_EX_STATICEDGE ) GUISetOnEvent(-1, "var_outputA") ;preload stuff ;MY Buttons $Button1 = GUICtrlCreateButton('Ping me', 10, 75, 100, 20, 0) GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console") GUICtrlSetCursor ($Button1, 0) GUICtrlSetOnEvent(-1, "var_outputA") ;Handling the GUI While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE;Exit form GUI Exitloop Case $msg = $Button1 Return_ping() Case Else ; Something else EndSelect Wend Exit func Special() EndFunc func Return_ping() ping("127.0.0.1",200) EndFunc func var_outputA() GUICtrlSetData ($output,(Return_ping()&@CRLF),1) EndFunc Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 5, 2007 Moderators Share Posted March 5, 2007 (edited) No idea what you mean by display the output of ping, have you looked at what Ping returns? A 1 for success and a 0 for none.;GUI stuff #include <GUIConstants.au3> GUICreate("Possessed Portal", 300, 480) GUISetState(@SW_SHOW) GUISetBkColor(0x000000) $output = GUICtrlCreateEdit('**************************Console V1.0**************************' & @CRLF, 0, 230, 300, 200, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY, $WS_EX_STATICEDGE) ;preload stuff ;MY Buttons $Button1 = GUICtrlCreateButton('Ping me', 10, 75, 100, 20, 0) GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console") GUICtrlSetCursor($Button1, 0) ;Handling the GUI While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE;Exit form GUI ExitLoop Case $msg = $Button1 var_outputA () Case Else ; Something else EndSelect WEnd Exit Func Special() EndFunc ;==>Special Func Return_ping() Return Ping("127.0.0.1", 200) EndFunc ;==>Return_ping Func var_outputA () GUICtrlSetData($output, (Return_ping() & @CRLF), 1) EndFunc ;==>var_outputAAlso helps if you call the right function first . Edit: You also can't use OnEventMode with GUIGetMsg() Edited March 5, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
GEOSoft Posted March 5, 2007 Share Posted March 5, 2007 Hello all again i am having some problems. I am trying to make a simple output dialog that outputs my ping when i press the button. also i will be adding more funcs as i go along to output to this dialog. And yes my code is very messy so please no flaming . anyways hope someone can help me thanks peace.c expandcollapse popup;GUI stuff #include <GUIConstants.au3> GUISetOnEvent($GUI_EVENT_CLOSE, "Special") GUICreate("Possessed Portal",300,480) GUISetState (@SW_SHOW) GUISetBkColor (0x000000) $output = GUICtrlCreateEdit('**************************Console V1.0**************************'&@CRLF, 0,230, 300,200,$ES_AUTOVSCROLL+$WS_VSCROLL+$ES_READONLY, $WS_EX_STATICEDGE ) GUISetOnEvent(-1, "var_outputA") ;preload stuff ;MY Buttons $Button1 = GUICtrlCreateButton('Ping me', 10, 75, 100, 20, 0) GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console") GUICtrlSetCursor ($Button1, 0) GUICtrlSetOnEvent(-1, "var_outputA") ;Handling the GUI While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE;Exit form GUI Exitloop Case $msg = $Button1 Return_ping() Case Else ; Something else EndSelect Wend Exit func Special() EndFunc func Return_ping() ping("127.0.0.1",200) EndFunc func var_outputA() GUICtrlSetData ($output,(Return_ping()&@CRLF),1) EndFuncI see where you are calling Return_Ping() but not where you are calling var_outputA(). It' doesnt matter because yoy don't need either. Case $Msg = $Button1 $o = Ping("127.0.0.1", 200) GUICtrlSetData($Output, $o) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 5, 2007 Moderators Share Posted March 5, 2007 I have a feeling... just a sneaky one, that this is more what he's after:;GUI stuff #include <GUIConstants.au3> GUICreate("Possessed Portal", 300, 480) GUISetBkColor(0x000000) $output = GUICtrlCreateEdit('**************************Console V1.0**************************' & @CRLF, 0, 230, 300, 200, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY, $WS_EX_STATICEDGE) ;preload stuff ;MY Buttons $Button1 = GUICtrlCreateButton('Ping me', 10, 75, 100, 20, 0) GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console") GUICtrlSetCursor($Button1, 0) GUISetState(@SW_SHOW) ;Handling the GUI While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE;Exit form GUI ExitLoop Case $msg = $Button1 GUICtrlSetData($output, GUICtrlRead($output) & Return_ping() & @CRLF) Case Else ; Something else EndSelect WEnd Func Return_ping() Local $iPID = Run(@ComSpec & ' /c ping ' & @IPAddress1 & ' -n 1', '', @SW_HIDE, 2), $sHold = '' While Not @error $sHold &= StdoutRead($iPID) WEnd Return $sHold EndFunc ;==>Return_ping Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Possessed Posted March 5, 2007 Author Share Posted March 5, 2007 (edited) !!!! Smoke man i love you! I posted before you but damn man thats right on the money man! autoit god you are. you never fail me Edited March 5, 2007 by Possessed Link to comment Share on other sites More sharing options...
FreeFry Posted March 5, 2007 Share Posted March 5, 2007 (edited) What purpose does pinging 127.0.0.1 have? O_o network diagnostics? Edited March 5, 2007 by FreeFry 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