Jump to content

How to add the "transfer rate" to the script?


Recommended Posts

DirCreate("Downloads")
_RandomProxy(Random(1,10,1))

$FileUrl = InputBox("Download", "Url:", "", "", -1, 10)
$FileName = InputBox("Save As", "Save As:", "", "", -1, 10)

_Download($FileUrl, @scriptDir & "/Downloads/" & $FileName )
Sleep(100)

Func _Download($File, $name)
    $FileSize1 = InetGetSize($file)
    InetGet($file, $name, 1, 1)
    While @InetGetActive
        
        $filedownload = Round(@InetGetBytesRead / 1048576, 5)
        $Percent = $filedownload / $FileSize1
        
        Traytip("", "" & $filedownload & "Mb", 10, 16)
        Sleep(250)
    WEnd
    Sleep(500)
EndFunc

Func _RandomProxy($Number)
     Select
          Case $Number = 1
               HttpSetProxy(2, "211.215.17.73:4480")
               TrayTip("", "**Proxy 1**", 10)
          Case $Number = 2
               HttpSetProxy(2, "211.60.157.8:50050")
               TrayTip("", "**Proxy 2**", 10)
          Case $Number = 3
               HttpSetProxy(2, "211.115.235.18:8080")
               TrayTip("", "**Proxy 3**", 10)
          Case $Number = 4
               HttpSetProxy(2, "219.255.65.194:8080")
               TrayTip("", "**Proxy 4**", 10)
          Case $Number = 5
               HttpSetProxy(2, "220.77.98.160:8080")
               TrayTip("", "**Proxy 5**", 10)
          Case $Number = 6
               HttpSetProxy(2, "221.165.193.61:8080")
               TrayTip("", "**Proxy 6**", 10)
          Case $Number = 7
               HttpSetProxy(2, "222.99.209.235:8080")
               TrayTip("", "**Proxy 7**", 10)
          Case $Number = 8
               HttpSetProxy(2, "221.155.8.143:8080")
               TrayTip("", "**Proxy 8**", 10)
          Case $Number = 9
               HttpSetProxy(2, "221.138.36.46:8080")
               TrayTip("", "**Proxy 9**", 10)
          Case $Number = 10
               HttpSetProxy(2, "211.48.25.2:8080")
               TrayTip('', "**Proxy 10**", 10)
     EndSelect
 EndFunc

What I want to do:

In the _Download Function, I want, underneath, the mb downloaded, I want to have the transfer speed.

Is this possible?

If so, How would I go about doing this?

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

Adjust to your own preferences... MB/Minute, KB/sec, etc...

Func _Download($File, $name)
    $FileSize1 = InetGetSize($file)
    $LastSize = 0
    InetGet($file, $name, 1, 1)
    While @InetGetActive
        $speed = int((@InetGetBytesRead - $LastSize) /1000)
        $LastSize = @InetGetBytesRead
       
        $filedownload = Round(@InetGetBytesRead / 1048576, 5)
        $Percent = $filedownload / $FileSize1
        Traytip("", "" & $filedownload & "Mb" & @LF & $speed & " KB/s", 10, 16)
        Sleep(1000)
    WEnd
    Sleep(500)
EndFunc

Edited by Skruge

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

Adjust to your own preferences... MB/Minute, KB/sec, etc...

Func _Download($File, $name)
    $FileSize1 = InetGetSize($file)
    $LastSize = 0
    InetGet($file, $name, 1, 1)
    While @InetGetActive
       $speed = int((@InetGetBytesRead - $LastSize) /1000)
       
        $filedownload = Round(@InetGetBytesRead / 1048576, 5)
        $Percent = $filedownload / $FileSize1
        Traytip("", "" & $filedownload & "Mb" & @LF & $speed & " KB/s", 10, 16)
        Sleep(1000)
    WEnd
    Sleep(500)
EndFunc
Hmm, this code you gave, is that like, working? or just an example kinda thing, because I tryed that, but the $speed just keeps going up, it hadnt done 1mb yet, and it was on 400kbs going up, and thats now right.
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

$speed just keeps going up, it hadnt done 1mb yet, and it was on 400kbs going up, and thats now right.

Argh... I was testing it in my own function, then pasted it into yours to post... left out the part where we update $LastSize.

(Updated code in my last post)

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

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...