Jump to content

Question IE and Progress


Recommended Posts

Hello everyone,

Question 1: How to attach an IE Download to a Progressbar?

Question 2: How to make an IE Download like a streaming Download(download can be paused and continued every time)?

Question 3: How to do it with my UDF like Code :o?

Question 4: How to do add a Label which shows the released time?

Question 5: How to show how long it takes also the Connection Speed?

Question 6: How to get the Connection Speed to a Server?

#include-once
#include <MsgBoxConstants.au3>
; #FUNCTION# ====================================================================================================================
; Name ..........: _Patch
; Description ...: Easy Patch System(unzipping currently not included)
;                  I could need a bit help for this code ^-^.
; Syntax ........: _Patch($DownloadURL, $DownloadPath)
; Parameters ....: $DownloadURL         - URL for the Download.
;                  $DownloadPath        - Where the download file will be installed.
;                  $Title               - Project Name Will be displayed in the MsgBox.
; Return values .: None
; Author ........: RaiNote
; Modified ......: 
; Remarks .......: 
; Related .......: 
; Link ..........: 
; Example .......: No
; ===============================================================================================================================Func _Patch($DownloadURL,$DownloadPath)
Func _Patch($DownloadURL,$DownloadPath,$Title = "Title")
    
$Byte = InetGetSize($DownloadURL,0);Download Size
    
    If $Byte > 1024 Then
        
    $Kilobyte = $Byte / 1024;Converting Byte to Kilobytes
        
        If $Kilobyte > 1024 Then
            
        $Megabyte = $Kilobyte / 1024;Converting Kilobyte to Megabyte
            
            If $Megabyte > 1024 Then
                
            $Gigabyte = $Megabyte / 1024;Converting Megabyte to Gigabyte
            
                If $Gigabyte > 1024 Then
                
                $Terabyte = $Gigabyte / 1024;Converting Gigabyte to Terabyte
                
                    If $Terabyte > 1024 Then
                    
                    $Petabyte = $Terabyte / 1024;Converting Terabyte to Petabyte
                    
                        If $Petabyte > 1024 Then
                            
                            $Exabyte = $Petabyte / 1024;Converting Petabyte to Exabyte
                            $_PATCH_SIZE1 = Round($Exabyte,2) & " EB"
                            
                        ElseIf $Petabyte < 1024 Then
                            
                            $Petabyte = $Terabyte / 1024
                            $_PATCH_SIZE1 = Round($Petabyte,2) & " PB"
                            
                        EndIf
                        
                    ElseIf $Terabyte < 1024 Then
                    
                    $Terabyte = $Gigabyte / 1024
                    $_PATCH_SIZE1 = Round($Terabyte,2) & " TB"
                    
                    EndIf
                
                ElseIf $Gigabyte < 1024 Then
                
                $Gigabyte = $Megabyte / 1024
                $_PATCH_SIZE1 = Round($Gigabyte,2) & " GB"
                
                EndIf
                
            ElseIf $Megabyte < 1024 Then
                
            $Megabyte = $Kilobyte / 1024
            $_PATCH_SIZE1 = Round($Megabyte,2) & " MB"
                
            EndIf
            
        ElseIf $Kilobyte < 1024 Then
            
        $Kilobyte = $Byte / 1024
        $_PATCH_SIZE1 = Round($Kilobyte,2) & " KB"
            
        EndIf
        
    ElseIf $Byte < 1024 Then
    
    $_PATCH_SIZE1 = $Byte & " Bytes"
    
EndIf
    
$_PATCH_INFO = MsgBox(52,$Title,$Title & "needs to be patched. If u want to patch continue" & @CRLF & " if not it will close automaticly.(Size :" & " " & $_PATCH_SIZE1 & ")",0)

switch $_PATCH_INFO

    case 6 ;YES
    
    $_Patch_Download = InetGet($DownloadURL,$DownloadPath,0,0)

    case 7 ;NO
    
    Exit

endswitch
        
EndFunc

RaiNote, not the final answer you're looking for, but you may start by simplifying your math and reducing clutter in the script. Instead of all the If statements (67 lines if I count correctly), you could do something like this (20 lines, not counting comments):

;b = 1
;KB = 1024
;MB = 1,048,576
;GB = 1,073,741,824
;TB = 1,099,511,627,776
;PB = 1,125,899,906,842,624
;EB = 1,152,921,504,606,846,976

$DownloadURL = "https://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe"
$iReturn = InetGetSize($DownloadURL,0);Download Size

    Select
        Case $iReturn > 1152000000000000000 ;Exabyte
            $FileSize = Round($iReturn / (1024 ^ 6), 2) & "EB"
        Case $iReturn > 1125000000000000
            $FileSize = Round($iReturn / (1024 ^ 5), 2) & "PB"
        Case $iReturn > 1099000000000
            $FileSize = Round($iReturn / (1024 ^ 4), 2) & "TB"
        Case $iReturn > 1073000000
            $FileSize = Round($iReturn / (1024 ^ 3), 2) & "GB"
        Case $iReturn > 1048000
            $FileSize = Round($iReturn / (1024 ^ 2), 2) & "MB"
        Case $iReturn > 1024
            $FileSize = Round($iReturn / 1024, 2) & "KB"
        Case Else
            $FileSize = Round($iReturn) & "Bytes"
    EndSelect



ConsoleWrite($FileSize & @CRLF)

 

​Thx for this :o

I hope someone could help me :3 also how is this UDF with the FileSizeSystem :o

P.S.: Also a cat can get shy.

Edited by RaiNote
  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Link to comment
Share on other sites

  • Moderators

RaiNote, not the final answer you're looking for, but you may start by simplifying your math and reducing clutter in the script. Instead of all the If statements (67 lines if I count correctly), you could do something like this (20 lines, not counting comments):

;b = 1
;KB = 1024
;MB = 1,048,576
;GB = 1,073,741,824
;TB = 1,099,511,627,776
;PB = 1,125,899,906,842,624
;EB = 1,152,921,504,606,846,976

$DownloadURL = "https://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe"
$iReturn = InetGetSize($DownloadURL,0);Download Size

    Select
        Case $iReturn > 1152000000000000000 ;Exabyte
            $FileSize = Round($iReturn / (1024 ^ 6), 2) & "EB"
        Case $iReturn > 1125000000000000
            $FileSize = Round($iReturn / (1024 ^ 5), 2) & "PB"
        Case $iReturn > 1099000000000
            $FileSize = Round($iReturn / (1024 ^ 4), 2) & "TB"
        Case $iReturn > 1073000000
            $FileSize = Round($iReturn / (1024 ^ 3), 2) & "GB"
        Case $iReturn > 1048000
            $FileSize = Round($iReturn / (1024 ^ 2), 2) & "MB"
        Case $iReturn > 1024
            $FileSize = Round($iReturn / 1024, 2) & "KB"
        Case Else
            $FileSize = Round($iReturn) & "Bytes"
    EndSelect



ConsoleWrite($FileSize & @CRLF)

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Oh Thanks for this ^-^ but why the Script was so big was caused by liking If Statements :o but your code could anyway help but where is the "Download".part file because this is normally the file which got the current data what is downloaded :o I'm searching since hours for this file. Nah whatever Thank you very much. Also that isn't one question.

 

Edited by RaiNote
  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

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

×
×
  • Create New...