Downloader

  • ich weiß nicht wie ich ein Download progress machen kann in der neuen autoit version ...
    bräuchte da bissl hilfe

    "Skript"
    [autoit]


    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiStatusBar.au3>
    #include <ProgressConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 339, 135, 192, 124)
    $Input1 = GUICtrlCreateInput("Input1", 8, 8, 321, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL))
    $Button1 = GUICtrlCreateButton("======> Download <======", 8, 32, 323, 25, $WS_GROUP)
    $Progress1 = GUICtrlCreateProgress(8, 64, 326, 25)
    $StatusBar1 = _GUICtrlStatusBar_Create($Form1)
    _GUICtrlStatusBar_SetSimple($StatusBar1)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    case $Button1
    $link = GUICtrlRead($Input1)
    $name = InputBox("Please enter a name !","filename")
    inetget($link,$name,1,1)
    EndSwitch
    WEnd

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

    func _Download()
    ; weiß nicht
    ; wie das geht
    ; deswegen frage
    ; ich ja auch^^
    _GUICtrlStatusBar_SetText($StatusBar1, "Download Abgeschlossen")
    EndFunc

    [/autoit]
    &quot;FertigesScript&quot;
    [autoit]


    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiStatusBar.au3>
    #include <ProgressConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Downloader!", 339, 112, 192, 124)
    $Input1 = GUICtrlCreateInput("Input1", 0, 8, 339, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL))
    $Button1 = GUICtrlCreateButton("======> Download <======", 0, 32, 339, 25, $WS_GROUP)
    $Progress1 = GUICtrlCreateProgress(0, 60, 339, 25)
    $StatusBar1 = _GUICtrlStatusBar_Create($Form1)
    _GUICtrlStatusBar_SetSimple($StatusBar1)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $Percent = 0
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    case $Button1
    $link = GUICtrlRead($Input1)
    $name = InputBox("Please enter a name !","filename")
    $load = InetGet($link,$name,1,1)
    Do
    $filesize = InetGetInfo($load, 1)
    Sleep(100)
    GUICtrlSetData($Progress1,(InetGetInfo($load, 0)/$filesize)*100)
    $Percent = Round((InetGetInfo($load,0)/$filesize)*100,0)
    _GUICtrlStatusBar_SetText($StatusBar1,"schon "& $Percent & "% Gedownloadet")
    Until InetGetInfo($load, 2)
    _GUICtrlStatusBar_SetText($StatusBar1, "Download Abgeschlossen")
    EndSwitch
    WEnd

    [/autoit]
    [autoit]


    #cs-----------------------------------------------------------------------------
    Hilfe ist immer gut also nimmt sie an ^^
    #ce-----------------------------------------------------------------------------

    [/autoit]

    5 Mal editiert, zuletzt von johnnyboyy (10. Mai 2010 um 14:43)

  • .... genau das weiß ich ja nicht wies geht......

    [autoit]


    #cs-----------------------------------------------------------------------------
    Hilfe ist immer gut also nimmt sie an ^^
    #ce-----------------------------------------------------------------------------

    [/autoit]
  • Vielleicht hilft dir dieser Script von Deepred weiter:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>
    #include <WindowsConstants.au3>

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

    Global $Old1 = 0
    Global $Old2 = 0

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

    $Form1 = GUICreate("Form1", 425, 55, 192, 124)
    $Progress1 = GUICtrlCreateProgress(8, 8, 414, 17)
    $Progress2 = GUICtrlCreateProgress(8, 32, 414, 17)
    GUISetState(@SW_SHOW)

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

    $Download_1 = "http://download.mozilla.org/?product=firefox-3.0.10&os=win&lang=de"
    $Download_2 = "http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe"

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

    $Size_1 = InetGetSize($Download_1)
    $Size_2 = InetGetSize($Download_2)

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

    $Download_1 = InetGet($Download_1, @ScriptDir & "\Firefox.exe", 1, 1)
    $Download_2 = InetGet($Download_2, @ScriptDir & "\autoit-v3-setup.exe", 1, 1)

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

    $Init = TimerInit()

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

    While @InetGetActive

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

    If TimerDiff($Init) > 50 Then
    $Download_Prozent_1 = 100 * FileGetSize(@ScriptDir & "\Firefox.exe") / $Size_1
    $Download_Prozent_2 = 100 * FileGetSize(@ScriptDir & "\autoit-v3-setup.exe") / $Size_2

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

    GUICtrlSetData($Progress1, Round($Download_Prozent_1))
    GUICtrlSetData($Progress2, Round($Download_Prozent_2))

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

    $Init = TimerInit()
    EndIf

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

    WEnd

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit]
  • @InetGetActive funktioniert bei mir nicht mehr seit der neuen version...

    [autoit]


    #cs-----------------------------------------------------------------------------
    Hilfe ist immer gut also nimmt sie an ^^
    #ce-----------------------------------------------------------------------------

    [/autoit]
  • wie soll ich das mit Do Until machen??

    sorry benutze diese Funktionen kaum...

    [autoit]


    #cs-----------------------------------------------------------------------------
    Hilfe ist immer gut also nimmt sie an ^^
    #ce-----------------------------------------------------------------------------

    [/autoit]
  • Im Script davor hat mit While und WEnd etwas solange gemacht, bis etwas nicht mehr eintrifft.

    Spoiler anzeigen
    [autoit]

    While @InetGetActive

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

    If TimerDiff($Init) > 50 Then
    $Download_Prozent_1 = 100 * FileGetSize(@ScriptDir & "\Firefox.exe") / $Size_1
    $Download_Prozent_2 = 100 * FileGetSize(@ScriptDir & "\autoit-v3-setup.exe") / $Size_2

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

    GUICtrlSetData($Progress1, Round($Download_Prozent_1))
    GUICtrlSetData($Progress2, Round($Download_Prozent_2))

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

    $Init = TimerInit()
    EndIf

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

    WEnd

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

    Mit Do .. Until machst du etwas solange, bis etwas bestimmtes passiert

    d.h.:

    Do
    Machte weiter mit der Progressbar

    Until du 100% hast

  • danke ideas2code funktioniert prima^^ habe inetgetinfo übersehen^^ :thumbup:

    [autoit]


    #cs-----------------------------------------------------------------------------
    Hilfe ist immer gut also nimmt sie an ^^
    #ce-----------------------------------------------------------------------------

    [/autoit]