Sophos-Download (Progressbar)

  • Hallo 'Gemeinde' *g*,

    In der Vergangenheit hatte ich mich mal hier im Forum zum Thema 'Progressbar' geäussert (mal suchen ? :rolleyes:). Nun die Fortsetzung ... seht selbst. :tongue:

    Spoiler anzeigen
    [autoit]


    #NoTrayIcon
    Global Const $ES_AUTOVSCROLL = 64
    Global Const $ES_AUTOHSCROLL = 128
    Global Const $ES_WANTRETURN = 4096
    Global Const $WS_POPUPWINDOW = 0x80880000
    Global Const $WS_EX_CLIENTEDGE = 0x00000200
    Global Const $WS_EX_TOOLWINDOW = 0x00000080
    Global Const $WS_GROUP = 0x00020000
    Global Const $ES_READONLY = 0x0800
    Global Const $GUI_SHOW = 16
    Global Const $GUI_HIDE = 32
    Global Const $GUI_DISABLE = 128
    Global Const $PBS_SMOOTH = 1
    Global Const $PBS_VERTICAL = 4
    Global Const $SS_LEFT = 0x0000
    Global Const $SS_RIGHT = 0x0002
    Global Const $SS_CENTER = 0x01
    Global Const $WS_EX_OVERLAPPEDWINDOW = 0x00000300
    Global Const $WS_EX_TRANSPARENT = 0x00000020
    Global Const $SS_NOTIFY = 0x0100
    Global $file_size_bytes = 1
    Global $file_size = 1
    $Datei1 = "sav32sfx.exe"
    $Quelle1 = "http://www.sophos.com/tools/sav32sfx.exe"
    $Ziel1 = @ScriptDir & $Datei1
    $Form1 = GUICreate("", 316, 120, -1, -1,$WS_POPUPWINDOW,$WS_EX_TOOLWINDOW)
    GUISetBkColor(0x151843)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Group1 = GUICtrlCreateGroup("sophos 'sav32sfx.exe' - download ", 8, 8, 300, 94)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label1 = GUICtrlCreateLabel("",24,30,170,17)
    GUICtrlSetColor(-1, 0xFEADA2)
    $Label2 = GUICtrlCreateLabel("",24,50,140,17)
    GUICtrlSetColor(-1, 0xC0C0FF)
    $Label3 = GUICtrlCreateLabel("",225,50,70,17, $SS_RIGHT)
    GUICtrlSetColor(-1, 0xFFCB84)
    $Label4 = GUICtrlCreateLabel("",230,70,50,17, $SS_RIGHT)
    GUICtrlSetColor(-1, 0xE0E0E0)
    GUISetState(@SW_SHOW)
    _download_progress($Datei1,$Quelle1)
    Sleep(1000)
    Func _download_progress($filename, $fileurl)
    $msg_downloading =""
    $file_size_bytes = InetGetSize($fileurl)
    $file_size = $file_size_bytes
    InetGet($fileurl, $filename, 1, 1)
    Global $startDownloadTime = TimerInit()
    While @InetGetActive
    Sleep(50)
    $iniDown = @InetGetBytesRead
    $xx1 = Round((($iniDown/$file_size_bytes)*100) , 2)
    $xx2 = 24 + $xx1*2
    $xx3 = 1 + Floor($xx1)
    $Progress1=GUICtrlCreateLabel("",$xx2, 70, 1, 17)
    $Farbe=Int(256 - ($xx3 / 128)*255) *65536 + Int((512 * $xx3 / 256)* 255) + Int(($xx3 / 100 * 255) - 512)
    GUICtrlSetBkColor($Progress1, $Farbe)
    $Left = (($file_Size - @InetGetBytesRead) / $iniDown) * TimerDiff($startDownloadTime)
    $msg_load = StringFormat("%03.4f", $iniDown/1048576) & " MB / " & StringFormat("%3.4f", $file_Size/1048576) & " MB"
    $msg_zeit = _FormatTime(TimerDiff($startDownloadTime)) & " / " & _FormatTime($Left)
    $msg_speed = StringFormat("%3.2f",$iniDown/TimerDiff($startDownloadTime)) & " KB/s"
    GUICtrlSetData($Progress1,$xx2)
    GUICtrlSetData($Label1,$msg_load)
    GUICtrlSetData($Label2,$msg_zeit)
    GUICtrlSetData($Label3,$msg_speed)
    GUICtrlSetData($Label4,StringFormat("%3.2f",$xx1) & " %")
    Wend
    EndFunc
    Func _FormatTime($_time)
    $_hours = Floor($_time / 1000 / 3600)
    If $_hours < 10 Then $_hours = "0" & $_hours
    $_min = Int($_time / 1000 / 60)
    If $_min < 10 Then $_min = "0" & $_min
    $_sec = Int($_time / 1000)
    If $_sec < 10 Then $_sec = "0" & $_sec
    $_millisec = Round(Mod($_time, 100), 0)
    If $_millisec < 10 Then $_millisec = "0" & $_millisec
    Return $_hours & ":" & $_min & ":" & $_sec & "," & $_millisec
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    Gruß Trallala

    PS: Der Geburtstag war einfach nur göttlich ...

    Einmal editiert, zuletzt von trallala (23. November 2007 um 04:50)

  • GtaSpider

    Ganz gelb? Also mir gefällt das bereits inder dargestellten Form. So wie Du es gerne hättet, erinnert das mich an eine Ampel. Ist dann ja rot, gelb und Grün. Neeeeeeee, also ich finde den fließenden Übergang echt coooooool.

    LG, Lina.

    P. S. Ist ja Geschmackssache, oder? ;)

    Lieben Gruß,
    Alina

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Geheime Information: ;)
    OuBVU5ebLhHu5QvlnAyQB4A7SzBrvWulwL7RLl2BdH5tI6sIYspeMKeXMSXl

  • Hallo GtaSpider,

    mein Gehirn raucht (oh, jeh - wenn dir das mal nicht gefällt, dann ... ;() !
    Mach' guck ;)

    Spoiler anzeigen
    [autoit]


    #NoTrayIcon
    Global Const $ES_AUTOVSCROLL = 64
    Global Const $ES_AUTOHSCROLL = 128
    Global Const $ES_WANTRETURN = 4096
    Global Const $WS_POPUPWINDOW = 0x80880000
    Global Const $WS_EX_CLIENTEDGE = 0x00000200
    Global Const $WS_EX_TOOLWINDOW = 0x00000080
    Global Const $WS_GROUP = 0x00020000
    Global Const $ES_READONLY = 0x0800
    Global Const $GUI_SHOW = 16
    Global Const $GUI_HIDE = 32
    Global Const $GUI_DISABLE = 128
    Global Const $PBS_SMOOTH = 1
    Global Const $PBS_VERTICAL = 4
    Global Const $SS_LEFT = 0x0000
    Global Const $SS_RIGHT = 0x0002
    Global Const $SS_CENTER = 0x01
    Global Const $WS_EX_OVERLAPPEDWINDOW = 0x00000300
    Global Const $WS_EX_TRANSPARENT = 0x00000020
    Global Const $SS_NOTIFY = 0x0100
    Global $file_size_bytes = 1
    Global $file_size = 1
    $Datei1 = "sav32sfx.exe"
    $Quelle1 = "http://www.sophos.com/tools/sav32sfx.exe"
    $Ziel1 = @ScriptDir & $Datei1
    $Form1 = GUICreate("", 316, 120, -1, -1,$WS_POPUPWINDOW,$WS_EX_TOOLWINDOW)
    GUISetBkColor(0x151843)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Group1 = GUICtrlCreateGroup("sophos 'sav32sfx.exe' - download ", 8, 8, 300, 94)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label1 = GUICtrlCreateLabel("",24,30,170,17)
    GUICtrlSetColor(-1, 0xFEADA2)
    $Label2 = GUICtrlCreateLabel("",24,50,140,17)
    GUICtrlSetColor(-1, 0xC0C0FF)
    $Label3 = GUICtrlCreateLabel("",225,50,70,17, $SS_RIGHT)
    GUICtrlSetColor(-1, 0xFFCB84)
    $Label4 = GUICtrlCreateLabel("",230,70,50,17, $SS_RIGHT)
    GUICtrlSetColor(-1, 0xE0E0E0)
    GUISetState(@SW_SHOW)
    _download_progress($Datei1,$Quelle1)
    Sleep(1000)
    Func _download_progress($filename, $fileurl)
    $msg_downloading =""
    $file_size_bytes = InetGetSize($fileurl)
    $file_size = $file_size_bytes
    InetGet($fileurl, $filename, 1, 1)
    Global $startDownloadTime = TimerInit()
    While @InetGetActive
    Sleep(50)
    $iniDown = @InetGetBytesRead
    $xx1 = Round((($iniDown/$file_size_bytes)*100) , 2)
    $xx2 = 24 + $xx1*2
    $xx3 = 1 + Floor($xx1)
    $Progress1=GUICtrlCreateLabel("",$xx2, 70, 1, 17)
    If $xx1 <60 Then
    $Farbe= Int(256 - (5.12*$xx3*2 / 512)*2.55) *65536 + Int((512 * $xx3*2 / 256)* 255) + Int(($xx3*2 / 100 * 255) - 512)
    Elseif $xx1 >60 Then
    $Farbe=Int(255 - (($xx3-60) / 128) * 255) *65536 -int(256 *($xx3-60)* 256) + Int((($xx3-60) / 100 * 255) - 512)
    EndIf
    GUICtrlSetBkColor($Progress1, $Farbe)
    $Left = (($file_Size - @InetGetBytesRead) / $iniDown) * TimerDiff($startDownloadTime)
    $msg_load = StringFormat("%03.4f", $iniDown/1048576) & " MB / " & StringFormat("%3.4f", $file_Size/1048576) & " MB"
    $msg_zeit = _FormatTime(TimerDiff($startDownloadTime)) & " / " & _FormatTime($Left)
    $msg_speed = StringFormat("%3.2f",$iniDown/TimerDiff($startDownloadTime)) & " KB/s"
    GUICtrlSetData($Progress1,$xx2)
    GUICtrlSetData($Label1,$msg_load)
    GUICtrlSetData($Label2,$msg_zeit)
    GUICtrlSetData($Label3,$msg_speed)
    GUICtrlSetData($Label4,StringFormat("%3.2f",$xx1) & " %")
    Wend
    EndFunc
    Func _FormatTime($_time)
    $_hours = Floor($_time / 1000 / 3600)
    If $_hours < 10 Then $_hours = "0" & $_hours
    $_min = Int($_time / 1000 / 60)
    If $_min < 10 Then $_min = "0" & $_min
    $_sec = Int($_time / 1000)
    If $_sec < 10 Then $_sec = "0" & $_sec
    $_millisec = Round(Mod($_time, 100), 0)
    If $_millisec < 10 Then $_millisec = "0" & $_millisec
    Return $_hours & ":" & $_min & ":" & $_sec & "," & $_millisec
    EndFunc

    [/autoit]

    Einmal editiert, zuletzt von trallala (23. November 2007 um 19:05)

  • Cool.

    Da fällt mir doch zur Abendstunde noch was gutes ein.

    Wie wäre es, wenn man das ganze so macht, das man auch zwei Dateien auf einmal downloaden kann?

    Denke wenn das möglich ist an eine gewisse Anwendung bereits.

    LG, Lina.

    Lieben Gruß,
    Alina

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Geheime Information: ;)
    OuBVU5ebLhHu5QvlnAyQB4A7SzBrvWulwL7RLl2BdH5tI6sIYspeMKeXMSXl

  • Alina,

    warum habe ich so etwas von Dir erwartet ? ;)
    Das sollte für den Anfang reichen - oder? Ich will jetzt nicht sowas wie die "Gravitationstheorie" neu erfinden *g*

    Spoiler anzeigen
    [autoit]


    #NoTrayIcon
    Global Const $ES_AUTOVSCROLL = 64
    Global Const $ES_AUTOHSCROLL = 128
    Global Const $ES_WANTRETURN = 4096
    Global Const $WS_POPUPWINDOW = 0x80880000
    Global Const $WS_EX_CLIENTEDGE = 0x00000200
    Global Const $WS_EX_TOOLWINDOW = 0x00000080
    Global Const $WS_GROUP = 0x00020000
    Global Const $ES_READONLY = 0x0800
    Global Const $GUI_SHOW = 16
    Global Const $GUI_HIDE = 32
    Global Const $GUI_DISABLE = 128
    Global Const $SS_LEFT = 0x0000
    Global Const $SS_RIGHT = 0x0002
    Global Const $SS_CENTER = 0x01
    Global Const $WS_EX_OVERLAPPEDWINDOW = 0x00000300
    Global Const $WS_EX_TRANSPARENT = 0x00000020
    Global Const $SS_NOTIFY = 0x0100
    Global $file_size_bytes = 1
    Global $file_size = 1
    Dim $name[2] = ["'sav32sfx.exe' - (test)download","'bitdefender_free_v10.exe' - (test)download"]
    Dim $auswahl[2][2] = _
    [["http://www.sophos.com/tools/sav32sfx.exe", _
    @ScriptDir & "\sav32sfx.exe"], _
    ["http://download.bitdefender.com/windows/free/winfree/en/bitdefender_free_v10.exe", _
    @ScriptDir & "\bitdefender_free_v10.exe"]]
    _download_progress($auswahl)
    Sleep(1000)
    Func _download_progress($quelle)
    $Form1 = GUICreate("", 316, 220, -1, -1,$WS_POPUPWINDOW,$WS_EX_TOOLWINDOW)
    GUISetBkColor(0x151843)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Group1 = GUICtrlCreateGroup("", 8, 8, 300, 94)
    GUICtrlSetColor($Group1, 0x5B6688)
    $Label11 = GUICtrlCreateLabel("",24,30,170,17)
    GUICtrlSetColor(-1, 0xFEADA2)
    $Label12 = GUICtrlCreateLabel("",24,50,140,17)
    GUICtrlSetColor(-1, 0xC0C0FF)
    $Label13 = GUICtrlCreateLabel("",225,50,70,17, $SS_RIGHT)
    GUICtrlSetColor(-1, 0xFFCB84)
    $Label14 = GUICtrlCreateLabel("",230,70,50,17, $SS_RIGHT)
    GUICtrlSetColor(-1, 0xE0E0C0)
    $Group2 = GUICtrlCreateGroup("'Gesamt' - (test)download", 8, 110, 300, 94)
    GUICtrlSetColor($Group2, 0x5B6688)
    $Label21 = GUICtrlCreateLabel("",24,132,170,17)
    GUICtrlSetColor(-1, 0xFEADA2)
    $Label22 = GUICtrlCreateLabel("",24,152,140,17)
    GUICtrlSetColor(-1, 0xC0C0FF)
    $Label23 = GUICtrlCreateLabel("",225,152,70,17, $SS_RIGHT)
    GUICtrlSetColor(-1, 0xFFCB84)
    $Label24 = GUICtrlCreateLabel("",230,172,50,17, $SS_RIGHT)
    GUICtrlSetColor(-1, 0xE0E0C0)
    GUISetState(@SW_SHOW)
    Global $startDownloadTime = TimerInit()
    $gesamt = 0
    $total = 0
    For $i = 0 To UBound($quelle) - 1
    $gesamt += InetGetSize($quelle[$i][0])
    Next
    For $i = 0 To UBound($quelle) - 1
    $file_size = InetGetSize($quelle[$i][0])
    InetGet($quelle[$i][0], $quelle[$i][1], 1, 1)
    GUICtrlSetData($Group1,$name[$i])
    $Leer = GUICtrlCreateLabel("",24, 70, 205, 17)
    GUICtrlSetBkColor($Leer, 0x151843)
    While @InetGetActive
    Sleep(50)
    $iniDown = @InetGetBytesRead
    $xx101 = Round((($iniDown/$file_size)*100) , 2)
    $xx102 = 24 + $xx101*2
    $xx103 = 1 + Floor($xx101)
    $Progress1 = GUICtrlCreateLabel("",$xx102, 70, 1, 17)
    $Farbe1 = Int(256 - ($xx103 / 128)*255) *65536 + Int((512 * $xx103 / 256)* 255) + Int(($xx103 / 100 * 255) - 512)
    GUICtrlSetBkColor($Progress1,$Farbe1)
    $Left = (($file_Size - @InetGetBytesRead) / $iniDown) * TimerDiff($startDownloadTime)
    $msg_load1 = StringFormat("%03.4f", $iniDown/1048576) & " MB / " & StringFormat("%3.4f", $file_Size/1048576) & " MB"
    $msg_zeit1 = _FormatTime($Left)
    $msg_speed = StringFormat("%3.2f",$iniDown/TimerDiff($startDownloadTime)) & " KB/s"
    GUICtrlSetData($Label11,$msg_load1)
    GUICtrlSetData($Label12,$msg_zeit1)
    GUICtrlSetData($Label13,$msg_speed)
    GUICtrlSetData($Label14,StringFormat("%3.2f",$xx101) & " %")
    $xx201 = Round(((($iniDown+$total)/$gesamt)*100) , 2)
    $xx202 = 24 + $xx201*2
    $xx203 = 1 + Floor($xx201)
    $Progress2 = GUICtrlCreateLabel("",$xx202, 172, 1, 17)
    If $xx201 <60 Then
    $Farbe2= Int(256 - (5.12 * $xx203 * 2 / 512) * 2.55) *65536 + Int((512 * $xx203 * 2 / 256)* 255) + Int(($xx203 * 2 / 100 * 255) - 512)
    Elseif $xx201 >60 Then
    $Farbe2= Int(256 - (($xx203 - 60) / 128) * 255) *65536 - int(256 * ($xx203 - 60) * 256) + Int((($xx203 - 60) / 100 * 255)) - 5052 - Int(($xx203/ 100 * $xx203-30)*2)
    EndIf
    GUICtrlSetBkColor($Progress2, $Farbe2)
    $msg_load2 = StringFormat("%03.4f", ($iniDown+$total)/1048576) & " MB / " & StringFormat("%3.4f", $gesamt/1048576) & " MB"
    $msg_zeit2 = _FormatTime(TimerDiff($startDownloadTime))
    GUICtrlSetData($Label21,$msg_load2)
    GUICtrlSetData($Label22,$msg_zeit2)
    GUICtrlSetData($Label24,StringFormat("%3.2f",$xx201) & " %")
    WEnd
    $total = $iniDown
    Next
    EndFunc
    Func _FormatTime($_time)
    $_hours = Floor($_time / 1000 / 3600)
    If $_hours < 10 Then $_hours = "0" & $_hours
    $_min = Int($_time / 1000 / 60)
    If $_min < 10 Then $_min = "0" & $_min
    $_sec = Int($_time / 1000)
    If $_sec < 10 Then $_sec = "0" & $_sec
    $_millisec = Round(Mod($_time, 100), 0)
    If $_millisec < 10 Then $_millisec = "0" & $_millisec
    Return $_hours & ":" & $_min & ":" & $_sec & "," & $_millisec
    EndFunc

    [/autoit]

    EDIT: Ich habe noch ein bisschen an der Formel "abgeraucht" ;)

    Gruß Trallala

    6 Mal editiert, zuletzt von trallala (25. November 2007 um 07:03)

  • hey ho sry das ich sowas altes nochmal rauskrame xD

    aba das wäre doch an sich n cooler downloader für diverse dinge, man könnte
    sowas einfügen, das man dort links einfügen kann + beschreibung, und diese
    dann in eine INI gespeichert werden. und bevor der downloader anfängt würde
    er alle einträge anzeigen und man könnte überall n harken vormachen, welche
    man downloaden will :)

    das wäre übercool...

    würd mich ja selber dransetzen aba der code ist für mich als "semi-pro" xD noch
    etwas zu komplex