I've made a bit of headway today. Here's something I've kludged together. Please read all the comments.
Pay particular regard to the two multipliers 32 and 1024, the raw data supplied by the WMI interface needs to be multiplied by these values to generate the total bytes received and sent. I think it's accurate tho am not 100% sure.
The problem is that these numbers are liable to be different on different systems, and I don't know how to find out what they are on a per system basis. I've looked all around but they just don't seem to exist. That's the task for us to crack.
regards, Jerry
Everything below here is the script:
' quick and dirty example to show how to display total bytes sent and received
' many thanks must go to [brazen weep] @ WC for his various pieces of code I've
' looked through, learnt from and re-edited into what I needed
' this code was developed by JerryHat @ WC with help from belsidaam @ WC
' in this form it's merely a technology demo that hardly does anything
' please don't copy it into a DX script edit window unless you know what
' you're doing. I don't see any way it could be harmful but I take no responsibility
' etc.
' that said, this code is freeware, take it, use it, don't bother to ask permission
' it would be nice to see the results tho
' to get it running you'll need to first find the proper InstanceName of your
' network adapter, mine is "NVIDIA nForce MCP Networking Controller"
' then create a new object in DX2.1, turn it into a text item in the states tab
' make a new script and copy and paste this script into it
' finally replace the InstanceName of my adapter with your own
' exit the edit script box and hit 'apply' on the properties dialog
' if all is well the bytes received and sent will display as your object
' hit 'apply' to force a refresh - sorry but I didn't have time to learn how
' to create a timer, as i said quick and dirty is the name of the game
' enjoy, JerryHat
' v0.1
Dim strComputer, objWMIService, total_string, total_obj
'Called when the script is executed
Sub Object_OnScriptEnter
total_string = ""
' get total bytes received and sent
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI")
' get total received
Set total_obj = objWMIService.ExecQuery("SELECT * FROM MSNdis_CoReceivePdusOk")
For Each objItem In total_obj
If objItem.InstanceName = "NVIDIA nForce MCP Networking Controller" Then
total_string = objItem.NdisCoReceivePdusOk * 32 & " bytes received "
End If
Next
' get total sent
Set total_obj = objWMIService.ExecQuery("SELECT * FROM MSNdis_CoTransmitPdusOk")
For Each objItem In total_obj
If objItem.InstanceName = "NVIDIA nForce MCP Networking Controller" Then
total_string = total_string & objItem.NdisCoTransmitPdusOk * 1024 & " bytes sent"
End If
Next
' display as object text
Object.text = total_string
End Sub
'Called when the script is terminated
Sub Object_OnScriptExit
End Sub