@ARPFre
you mean like this:
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
Global $Send
Global $threshhold_upload, $threshhold_download, $average_download_speed, $average_upload_speed
Global $objWMIServiceNTW = ObjGet("winmgmts:\\localhost\root\CIMV2"), $active_network_card, $Label1, $Label2, $Label5, $Label8
#Region ### START Koda GUI section ### Form=
$gui = GUICreate("T3.0.01b", 1079, 663, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_MAXIMIZE, $WS_TABSTOP, $DS_MODALFRAME))
$RadioOn = GUICtrlCreateRadio("On", 208, 72, 33, 17)
$RadioOff = GUICtrlCreateRadio("Off", 160, 72, 41, 17)
$Label1 = GUICtrlCreateLabel("Download speed: ", 30, 665, 200, 15)
$Label2 = GUICtrlCreateLabel("Max download speed:", 250, 665, 200, 15)
$Label5 = GUICtrlCreateLabel("Upload speed: ", 30, 650, 200, 15)
$Label8 = GUICtrlCreateLabel("Max upload speed:", 250, 650, 200, 15)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUICtrlCreateGroup("NetWork Active Info:", 15, 630, 835, 65)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $RadioOn
$Send = '_on'
;detect the active network card
$oSelect_active_network_cards = $objWMIServiceNTW.ExecQuery('Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True', "WQL")
for $oSelect_active_network_card in $oSelect_active_network_cards
$active_network_card = stringright($oSelect_active_network_card.Description, 6) ;get part of the name of the active network card
Next
$threshhold_download = 0
$threshhold_upload = 0
$average_download_speed = 0
$average_upload_speed = 0
case $RadioOff
$Send = '_off'
EndSwitch
update_speeds()
sleep(1)
WEnd
func update_speeds()
;get the download and upload speed
$oNetwork_cards = $objWMIServiceNTW.ExecQuery("SELECT BytesReceivedPerSec, BytesSentPerSec FROM Win32_PerfFormattedData_Tcpip_NetworkInterface WHERE name LIKE '%" & $active_network_card & "%'", "WQL")
For $oNetwork_card In $oNetwork_cards
if $Send = '_off' Then
GUICtrlSetData($Label1, "Real time download speed: ")
GUICtrlSetData($Label5, "Real time upload speed: ")
GUICtrlSetData($Label2, "Average download speed: ")
GUICtrlSetData($Label8, "Average upload speed: ")
Elseif $Send = '_on' Then
$current_download_speed = Round($oNetwork_card.BytesReceivedPerSec / 1024)
$current_upload_speed = Round($oNetwork_card.BytesSentPerSec / 1024)
GUICtrlSetData($Label1, "Real time download speed: " & $current_download_speed & " kB/s")
GUICtrlSetData($Label5, "Real time upload speed: " & $current_upload_speed & " kB/s")
;calculate the average download speed
if $current_download_speed > $threshhold_download then
$average_download_speed = Round(($current_download_speed + $average_download_speed) / 2)
GUICtrlSetData($Label2, "Average download speed: " & $average_download_speed & " kB/s")
EndIf
;calculate the average upload speed
if $current_upload_speed > $threshhold_upload Then
$average_upload_speed = Round(($current_upload_speed + $average_upload_speed) / 2)
GUICtrlSetData($Label8, "Average upload speed: " & $average_upload_speed & " kB/s")
EndIf
EndIf
Next
EndFunc ;==>update_speeds