Shredplayer 0 Posted September 8, 2011 i'm having problem on how to send control-c to stop "ping -t www.google.com", it won't send any commands because autoit won't process any request as long ping is in loop, here's my code and hope you can help me. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Include <GuiEdit.au3> #include <Constants.au3> #include <ScrollBarConstants.au3> $Form1 = GUICreate("Pinger", 328, 270, 192, 124) $url = GUICtrlCreateInput("", 78, 21, 233, 21) $Label1 = GUICtrlCreateLabel("Address :", 21, 23, 48, 17) $Edit1 = GUICtrlCreateEdit("", 18, 49, 293, 165) GUICtrlSetData(-1, "") $start = GUICtrlCreateButton("Start", 233, 229, 75, 25, 0) $stop = GUICtrlCreateButton("Stop", 156, 230, 75, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $start Pinger() Case $stop Consolewrite("Don't know how to stop") EndSwitch WEnd Func Pinger () GUICtrlSetData($Edit1, "") GUICtrlSetState ($start,$GUI_DISABLE) $address = GUICtrlRead($url) $ping = Run("ping.exe -t " & GUICtrlRead($url), "", @SW_HIDE,$STDERR_CHILD + $STDOUT_CHILD) while 1 $line = StdoutRead($ping & @CRLF) if @error then ExitLoop _GUICtrlEdit_AppendText($Edit1,$Line) _GUICtrlEdit_Scroll($Edit1, $SB_SCROLLCARET) sleep(100) Wend GUICtrlSetState ($start,$GUI_ENABLE) StdioClose($ping) EndFunc Share this post Link to post Share on other sites
Shredplayer 0 Posted September 8, 2011 any ideas guys? Share this post Link to post Share on other sites
Bert 1,430 Posted September 8, 2011 AdlibRegister perhaps would work. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Share this post Link to post Share on other sites
Shredplayer 0 Posted September 8, 2011 ok 'ill look into it thanks Share this post Link to post Share on other sites
Jos 2,211 Posted September 8, 2011 (edited) Something to play with: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include <Constants.au3> #include <ScrollBarConstants.au3> $Form1 = GUICreate("Pinger", 328, 270, 192, 124) $url = GUICtrlCreateInput("", 78, 21, 233, 21) $Label1 = GUICtrlCreateLabel("Address :", 21, 23, 48, 17) $Edit1 = GUICtrlCreateEdit("", 18, 49, 293, 165) GUICtrlSetData(-1, "") $start = GUICtrlCreateButton("Start", 233, 229, 75, 25, 0) $stop = GUICtrlCreateButton("Stop", 156, 230, 75, 25, 0) GUICtrlSetState($stop, $GUI_DISABLE) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $start Pinger() Case $stop ConsoleWrite("Don't know how to stop") EndSwitch WEnd Func Pinger() GUICtrlSetState($start, $GUI_DISABLE) GUICtrlSetState($stop, $GUI_ENABLE) GUICtrlSetData($Edit1, "") GUICtrlSetState($start, $GUI_DISABLE) $address = GUICtrlRead($url) $ping = Run("ping.exe -t " & GUICtrlRead($url), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line = StdoutRead($ping & @CRLF) If @error Then ExitLoop _GUICtrlEdit_AppendText($Edit1, $line) _GUICtrlEdit_Scroll($Edit1, $SB_SCROLLCARET) If GUIGetMsg() = $stop Then ProcessClose($ping) GUICtrlSetState($start, $GUI_ENABLE) GUICtrlSetState($stop, $GUI_DISABLE) ExitLoop EndIf WEnd GUICtrlSetState($start, $GUI_ENABLE) StdioClose($ping) EndFunc ;==>Pinger Edited September 8, 2011 by Jos 1 Shredplayer reacted to this SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites
Shredplayer 0 Posted September 8, 2011 Wow thanks, i never thought it's that simple it took me days trying to figure it out i tried AdlibRegister route but unsuccesful thanks you're the best! Share this post Link to post Share on other sites