Probiere mal dies aus: Network Interface Info, Statistics, and Traffic oder Traffic Metter
Gruß,
UEZ
Probiere mal dies aus: Network Interface Info, Statistics, and Traffic oder Traffic Metter
Gruß,
UEZ
Uuuppss, da war ja gestern noch was los hier
Habe die ganze Sache noch angepasst, kleine GUI und arbeite mit "sinvolleren" Einheiten. Könnt ja mal testen und sagen, ob die Werte jetzt hin kommen. Zumindestens bei mir scheints halbwegs zu passen.
Arbeite mitlerweile mit dieser Seite zum umrechnen http://www.umrechnung.org/masseinheiten-…chsatz-rate.htm
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>
Global $aReturn[4][2]
[/autoit] [autoit][/autoit] [autoit]$aReturn[0][0] = "Download Speed"
$aReturn[1][0] = "Upload Speed"
$aReturn[2][0] = "Name"
$aReturn[3][0] = "Bandbreite LAN"
$aReturn[0][1] = 0
$aReturn[1][1] = 0
$aReturn[2][0] = "No Data"
$aReturn[3][0] = "No Data"
Global $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20, $colItems = "", $strComputer = "localhost"
[/autoit] [autoit][/autoit] [autoit]$Main = GUICreate("Main",656,70,-1,-1,$WS_POPUP,-1)
$Input_Download = GUICtrlCreateInput("6737",91,7,51,20,-1,512)
GUICtrlCreateLabel("Downloadspeed:",5,10,81,15,-1,-1)
GUICtrlSetBkColor(-1,"-2")
$Label1 = GUICtrlCreateLabel("KiB/s",147,10,31,15,-1,-1)
GUICtrlSetBkColor(-1,"-2")
GUICtrlCreateLabel("Uploadspeed:",5,38,81,15,-1,-1)
GUICtrlSetBkColor(-1,"-2")
$Input_Upload = GUICtrlCreateInput("1310",91,35,51,20,-1,512)
$Label_Down = GUICtrlCreateLabel("",190,7,0,15,-1,-1)
GUICtrlSetColor(-1,"0x00FF00")
GUICtrlSetBkColor(-1,"0x00FF00")
$Label2 = GUICtrlCreateLabel("KiB/s",147,40,31,15,-1,-1)
GUICtrlSetBkColor(-1,"-2")
$Label_Up = GUICtrlCreateLabel("",190,40,0,15,-1,-1)
GUICtrlSetColor(-1,"0xFF0000")
GUICtrlSetBkColor(-1,"0xFF0000")
$Label_Downspeed = GUICtrlCreateLabel("",564,7,85,15,-1,-1)
GUICtrlSetBkColor(-1,"-2")
$Label_Upspeed = GUICtrlCreateLabel("",564,40,85,17,-1,-1)
GUICtrlSetBkColor(-1,"-2")
GUICtrlSetTip($Label1, "Kilobyte/Sekunde")
GUICtrlSetTip($Label2, "Kilobyte/Sekunde")
HotKeySet("+!x", "_Exit") ; Shift + Alt + x
[/autoit] [autoit][/autoit] [autoit]GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit]While 1
$MaxDownSpeed = GUICtrlRead($Input_Download)
$MaxUpSpeed = GUICtrlRead($Input_Upload)
$aTraffic = _NetworkSpeed()
$Upload = Round($aTraffic[1][1] * 0.000976563, 2)
GUICtrlSetData($Label_Upspeed, $Upload & " KiB/s")
$Download = Round($aTraffic[0][1] * 0.000976563, 2)
GUICtrlSetData($Label_Downspeed, $Download & " KiB/s")
$PositionDown = Round(($Download * 100) / $MaxDownSpeed)
GUICtrlSetState($Label_Down, $gui_hide)
GUICtrlSetPos($Label_Down, Default, Default, Round(350 * ($PositionDown / 100), 0), Default)
GUICtrlSetState($Label_Down, $GUI_SHOW)
$PositionUp = Round(($Upload * 100) / $MaxUpSpeed)
GUICtrlSetState($Label_Up, $gui_hide)
GUICtrlSetPos($Label_Up, Default, Default, Round(350 * ($PositionUp / 100), 0), Default)
GUICtrlSetState($Label_Up, $GUI_SHOW)
Sleep(500)
WEnd
Func _NetworkSpeed()
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_Tcpip_NetworkAdapter", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) Then
[/autoit] [autoit][/autoit] [autoit]For $objItem In $colItems
[/autoit] [autoit][/autoit] [autoit]If $objItem.BytesReceivedPersec > 0 Then
$aReturn[0][1] = $objItem.BytesReceivedPersec
$aReturn[1][1] = $objItem.BytesSentPersec
$aReturn[2][1] = $objItem.Name
$Bandweite = $objItem.CurrentBandwidth
If $Bandweite = 100000000 Then $aReturn[3][1] = "1 GBit"
If $Bandweite = 100000 Then $aReturn[3][1] = "100 MBit"
If $Bandweite = 1000 Then $aReturn[3][1] = "10 MBit"
Return $aReturn
EndIf
Next
Else
MsgBox(0, "WMI Output", "No WMI Objects Found for class: " & "Win32_PerfFormattedData_Tcpip_NetworkAdapter")
EndIf
Return $aReturn
EndFunc ;==>_NetworkSpeed
Func _Exit()
Exit
EndFunc ;==>_Exit
Gruß
MrB