Advertisement
AZJIO

ping, Console

Jun 9th, 2012
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.73 KB | None | 0 0
  1. #include <ScrollBarConstants.au3>
  2. #include <WindowsConstants.au3>
  3. #include <Encoding.au3>
  4. #include <GuiEdit.au3>
  5.  
  6. GUICreate('Ping Google', 600, 200)
  7. GUISetFont(9, 400, -1, 'Tahoma')
  8. $Edit = GUICtrlCreateEdit('', 10, 10, 580, 180, $WS_VSCROLL + $ES_READONLY)
  9. GUICtrlSetBkColor(-1, 0xCCCC99)
  10. $OK = GUICtrlCreateButton('OK', 280, 350, 60, 25)
  11. GUISetState()
  12. $PID = Run('ping -t 74.125.232.19', @SystemDir, @SW_HIDE, 2)
  13. $EditText = ''
  14. While 1
  15.     $line = StdoutRead($PID)
  16.     If @error Then ExitLoop
  17.     $EditText &= $line
  18.     If $line Then
  19.         GUICtrlSetData($Edit, _Encoding_866To1251($EditText))
  20.         _GUICtrlEdit_Scroll($Edit, $SB_BOTTOM)
  21.     EndIf
  22.     $msg = GUIGetMsg()
  23.     Switch $msg
  24.         Case -3, $OK
  25.             ProcessClose($PID)
  26.             Exit
  27.     EndSwitch
  28. WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement