Einfacher Downloader?

  • hi leute,

    hab das hier mal schnell geschrieben in der hoffung es funktioniert^^
    leider geht das downloaden nicht --- aber warum?
    ( der fehler ist bestimmt ganz einfach aber ich komm nicht drauf )

    [autoit]

    #include <GUIConstants.au3>
    #include <inet.au3>

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

    Global $Ipath
    $ip = _GetIP()
    $DW2 = (@DesktopWidth / 2) - 175

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

    GUICreate("[qD] QuickDownloader", 350, 90, $DW2, 10)
    $url = GUICtrlCreateInput("http://", 10, 20, 330, 20)
    $downl = GUICtrlCreateButton("Download", 50, 50, 100, 25)
    GUICtrlCreateLabel("User IP >> " & $ip, 160, 56, 205, 17)
    GUISetState(@SW_SHOW)

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

    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    $msg = GUIGetMsg()
    Case $msg = $downl
    $Ipath = GUICtrlRead($url)
    InetGet($Ipath)
    MsgBox(64, "[qD] Info", "Ihre angeforderte Datei wurde erfolgreich gespeichert! ")
    EndSelect
    WEnd

    [/autoit]


    mfg team2way

    3 Mal editiert, zuletzt von team2way (15. März 2009 um 00:06)

  • Hi.

    Ich hatte auch Probleme mit InetGet wenn ich keinen Zielpfad angegeben habe. (Obwohl man diesen ja optional nur eintrage müsste)

    Probier einfach mal Testweise:

    [autoit]


    InetGet($Ipath,@desktopdir&"\file")

    [/autoit]

    Lg

    Jaja, Moo does the Cow!

  • Jo ZielPfad fehlt. Mach das am besten so:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <inet.au3>

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

    Global $Ipath
    $ip = _GetIP()
    $DW2 = (@DesktopWidth / 2) - 175

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

    GUICreate("[qD] QuickDownloader", 350, 90, $DW2, 10)
    $url = GUICtrlCreateInput("http://", 10, 20, 330, 20)
    $downl = GUICtrlCreateButton("Download", 50, 50, 100, 25)
    GUICtrlCreateLabel("User IP >> " & $ip, 160, 56, 205, 17)
    GUISetState(@SW_SHOW)

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

    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    $msg = GUIGetMsg()
    Case $msg = $downl
    $Ipath = GUICtrlRead($url)
    $FileName = StringSplit($Ipath, "/")
    InetGet($Ipath, $FileName[UBound($FileName) - 1])
    MsgBox(64, "[qD] Info", "Ihre angeforderte Datei wurde erfolgreich gespeichert! ")
    EndSelect
    WEnd

    [/autoit]
  • thx für eure hilfe ^^

    noch ne frage kann man da jetzt noch so was einbaun wie folgt:

    wenn die url nicht existiert dann msgbox(Error)
    wie kann man das abfragen?

    mfg team2way

    Einmal editiert, zuletzt von team2way (14. März 2009 um 23:49)

  • Hi.

    Ersetze

    [autoit]


    InetGet($Ipath, $FileName[UBound($FileName) - 1])

    [/autoit]


    durch

    [autoit]


    If Not InetGet($Ipath, $FileName[UBound($FileName) - 1]) Then MsgBox(64,"Error","An unknown error occured")

    [/autoit]


    Lg,

    :)

    Jaja, Moo does the Cow!