Global $aPingArray[13] = [400,400,400,400,400,400,400,400,400,400,400,400,400] #include #include #include #include #include #Region ### START Koda GUI section ### Form= $Form = GUICreate("Ping", 601, 437, 558, 99) $Graph = GUICtrlCreateGraphic(0, 0, 600, 400) $IP_gr = _GUICtrlIpAddress_Create($Form, 8, 408, 130, 21) _GUICtrlIpAddress_Set($IP_gr, "0.0.0.0") $Bt = GUICtrlCreateButton("Start", 136, 408, 75, 23) $Time = GUICtrlCreateLabel("Time: ", 216, 412, 33, 20) GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _Lines(0xcccccc) GUICtrlSetGraphic($Graph,$GUI_GR_REFRESH) $state = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Bt If $state = 0 Then $state = 1 $IP = _GUICtrlIpAddress_Get($IP_gr) GUICtrlSetState($IP_gr,$GUI_DISABLE) GUICtrlSetData($Bt,"Stop") $hT = TimerInit() For $i = 0 To 12 _Graph(0xf0f0f0) $aPingArray[$i] = 400 Next ElseIf $state = 1 Then $state = 0 GUICtrlSetState($IP_gr,$GUI_ENABLE) GUICtrlSetData($Bt,"Start") EndIf EndSwitch If $state = 1 and TimerDiff($hT)>1000 Then $hT = TimerInit() _Graph(0xf0f0f0) $ping = Ping($IP,2000) if @error then $ping = 3000 _ReCalc($ping) _Lines(0xcccccc) _Graph(0x000000) GUICtrlSetGraphic($Graph,$GUI_GR_REFRESH) GUICtrlSetData($Time,$ping) EndIf WEnd Func _ReCalc($funcPing) For $i = 0 To 11 $aPingArray[$i] = $aPingArray[$i+1] Next $aPingArray[12]=400-($funcPing/5) EndFunc Func _Lines($LINEScolor) #Region HORIZONTAL GUICtrlSetGraphic($Graph, $GUI_GR_COLOR, $LINEScolor) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,000,400) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,600,400) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,000,200) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,600,200) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,000,300) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,600,300) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,000,100) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,600,100) #EndRegion #Region VERTICAL GUICtrlSetGraphic($Graph, $GUI_GR_COLOR, $LINEScolor) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,0,0) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,0,400) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,50,0) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,50,400) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,100,0) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,100,400) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,150,0) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,150,400) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,200,0) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,200,400) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,250,0) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,250,400) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,300,0) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,300,400) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,350,0) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,350,400) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,400,0) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,400,400) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,450,0) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,450,400) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,500,0) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,500,400) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,550,0) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,550,400) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,600,0) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,600,400) #EndRegion EndFunc Func _Graph($GRAPHcolor) GUICtrlSetGraphic($Graph,$GUI_GR_COLOR,$GRAPHcolor) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,000,$aPingArray[0]) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,050,$aPingArray[1]) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,050,$aPingArray[1]) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,100,$aPingArray[2]) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,100,$aPingArray[2]) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,150,$aPingArray[3]) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,150,$aPingArray[3]) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,200,$aPingArray[4]) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,200,$aPingArray[4]) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,250,$aPingArray[5]) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,250,$aPingArray[5]) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,300,$aPingArray[6]) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,300,$aPingArray[6]) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,350,$aPingArray[7]) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,350,$aPingArray[7]) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,400,$aPingArray[8]) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,400,$aPingArray[8]) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,450,$aPingArray[9]) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,450,$aPingArray[9]) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,500,$aPingArray[10]) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,500,$aPingArray[10]) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,550,$aPingArray[11]) GUICtrlSetGraphic($Graph,$GUI_GR_MOVE,550,$aPingArray[11]) GUICtrlSetGraphic($Graph,$GUI_GR_LINE,600,$aPingArray[12]) EndFunc