Jump to content

How to get inetget download speed ?


LIMITER
 Share

Recommended Posts

I posted this earlier tonight.

$objWMIService = ObjGet("winmgmts:\\.\root\cimv2")
$objClass = $objWMIService.ExecQuery("Select * from Win32_PerfRawData_Tcpip_NetworkInterface")

For $obj in $objClass
    msgbox(1,"","Interface: " & $obj.Name & @CRLF & _
                "Bytes Received/sec: " & $obj.BytesReceivedPerSec & @CRLF & _
                "Bytes Sent/sec: " & $obj.BytesSentPerSec & @CRLF & _
                "Bytes Total/sec: " & $obj.BytesTotalPerSec & @CRLF & _
                "Network rate: " & $obj.CurrentBandwidth)
Next

It just reports back in Bytes/sec, so just divide by 1024 to convert to KB/s. eg: "Round(obj.BytesReceivedPerSec /1024,2)" or something.

Edited by covaks
Link to comment
Share on other sites

I see. I'm not sure how to get that for external programs.. If you initiate the download with InetGet in your own script though, this should work:

$TotalSize = InetGetSize ( "ftp://ftp.microsoft.com/Products/frontpage/fp40.rs6000.tar.Z")
INetGet("ftp://ftp.microsoft.com/Products/frontpage/fp40.rs6000.tar.Z","File",1,1)

$hWnd = GUICreate("")
$Label = GUICtrlCreateLabel("",5,5,200,40)

GUISetState()

$Time = @SEC

While 1
    $msg = GUIGetMsg()
    
    $Time = @SEC
    $Bytes = Round(@InetGetBytesRead)
    While @SEC = $Time
    WEnd
    $NewBytes = Round(@InetGetBytesRead)

    GUICtrlSetData($Label,($NewBytes - $Bytes) /1024 & "KB/s")
WEnd
Edited by covaks
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...