Sign in to follow this  
Followers 0
LIMITER

How to get inetget download speed ?

6 posts in this topic

I have a script which downloads something from a website ... How can i measure the current download speed ? (like ie does)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

i used the script but this is showing ALL bytes received ... i want to show like uTorrent or Internet Explorer

Something like this :

203892 of 23890839840 kb downloaded

Download speed : 65.5 kb/s

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites
THX :)

Share this post


Link to post
Share on other sites

Sort of unrelated but the only program i've ever found that shows you upload / download speed for every process is called NetPeeker.

http://www.net-peeker.com/

Share this post


Link to post
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
Sign in to follow this  
Followers 0