InetGet Problem

  • Hi ich hatte vor meinem script einen updater zu schenken :D Leider will der updater nich so wie ich will.
    Hier der script: (Ich weis jemand hatte das selbe problem hat mir aber nix geholfen)

    Spoiler anzeigen
    [autoit]

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

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

    Dim $ver = "2.0"
    HttpSetUserAgent('Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10')
    If @OSArch = "X64" Then
    InetGet("http://molaynox.bplaced.net/UpdateX64.txt",@ScriptDir & "\Tmp\UpdateX64.txt", 1, 0)
    $file = FileOpen(@Scriptdir & "\update.txt", 0)
    $line = FileReadLine($file, 1)
    $line2 = FileReadLine($file, 2)
    EndIf
    If @OSArch = "X86" Then
    InetGet("http://molaynox.bplaced.net/Update.txt",@ScriptDir & "\Tmp\Update.txt", 1, 0)
    $file = FileOpen(@Scriptdir & "\update.txt", 0)
    $line = FileReadLine($file, 1)
    $line2 = FileReadLine($file, 2)
    EndIf
    If $line = $ver Then
    MsgBox(64, "Kein Update", "Du hast die neuste Version: (" & $ver & ")")
    FileClose($file)
    FileDelete(@Scriptdir & "\update.txt")
    If @OSArch = "X86" Then Run(@ScriptDir & "\BlackEyes StreamPlayer.exe")
    If @OSArch = "X64" Then Run(@ScriptDir & "\BlackEyes StreamPlayerX64.exe")
    Else
    MsgBox(64, "Update!", "Es ist eine Neue Version verfügbar!")
    $fg = MsgBox(4, "Updaten?", "Möchtest du jetzt Updaten?")
    If $fg = 6 Then
    HttpSetUserAgent('Firefox')
    $Form1 = GUICreate("Update herunterladen", 295, 133, 193, 125)
    $Progress1 = GUICtrlCreateProgress(20, 56, 260, 17)
    $Label1 = GUICtrlCreateLabel("Update ...", 20, 37, 260, 17)
    GUISetState(@SW_SHOW)
    $Source = $line2
    $aFile = StringSplit($Source, "/")
    Local $dest = @ScriptDir & "\" & $aFile[$aFile[0]]
    ConsoleWrite($dest & @CRLF)
    Local $nBytes, $nSize = InetGetSize($Source)
    Local $hDownload = InetGet($Source, $dest, 1, 1)

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

    Do
    Sleep(1000)
    $nBytes = InetGetInfo($hDownload, 0)
    $ipercent = Floor($nBytes / $nSize * 100)
    GUICtrlSetData($Progress1, $ipercent)
    GUICtrlSetData($Label1, $nBytes & " von " & $nSize & " Bytes = " & $ipercent & "% geladen")
    Until InetGetInfo($hDownload, 2) ; Check if the download is complete.
    Local $aData = InetGetInfo($hDownload) ; Get all information.
    InetClose($hDownload) ; Close the handle to release resourcs.
    MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _
    "Size: " & $aData[1] & @CRLF & _
    "Complete?: " & $aData[2] & @CRLF & _
    "Successful?: " & $aData[3] & @CRLF & _
    "@error: " & $aData[4] & @CRLF & _
    "@extended: " & $aData[5] & @CRLF)

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

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

    [/autoit]


    Was mache ich falsch???????? Das Script sagt immer das eine neue version verfügbar ist obwohl es nicht so ist und es lädt die .txt und die anderen dateien garnich herunter.

    Einmal editiert, zuletzt von Molaynox (13. Oktober 2010 um 12:38)

  • Leider will der updater nich so wie ich will.

    Ich muss sagen eine richtig tolle Fehlerbeschreibung. Die Lösung ist ganz einfach, mach das hier rein in dein Script:

    Spoiler anzeigen
    [autoit]

    MsgBox(0,"los","Du sollst jetzt funktionieren!")

    [/autoit]

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

  • Schön das meine Ironie verstanden hast und nun doch eine richtige Fehlerbeschreibung gepostet hast. Und hier die Lösung:

    Du speicherst die Datei nach:

    [autoit]

    @ScriptDir & "\Tmp\UpdateX64.txt"

    [/autoit]

    willst die Datei aber damit auslesen:

    [autoit]

    $file = FileOpen(@Scriptdir & "\update.txt", 0)

    [/autoit]

    sprich falscher Pfad.


    Probier es mal so:

    Spoiler anzeigen
    [autoit]

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

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

    Dim $ver = "2.0"
    HttpSetUserAgent('Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10')
    If @OSArch = "X64" Then
    InetGet("http://molaynox.bplaced.net/UpdateX64.txt",@ScriptDir & "\update.txt", 1, 0)
    $file = FileOpen(@Scriptdir & "\update.txt", 0)
    $line = FileReadLine($file, 1)
    $line2 = FileReadLine($file, 2)
    EndIf
    If @OSArch = "X86" Then
    InetGet("http://molaynox.bplaced.net/Update.txt",@ScriptDir & "\update.txt", 1, 0)
    $file = FileOpen(@Scriptdir & "\update.txt", 0)
    $line = FileReadLine($file, 1)
    $line2 = FileReadLine($file, 2)
    EndIf
    If $line = $ver Then
    MsgBox(64, "Kein Update", "Du hast die neuste Version: (" & $ver & ")")
    FileClose($file)
    FileDelete(@Scriptdir & "\update.txt")
    If @OSArch = "X86" Then Run(@ScriptDir & "\BlackEyes StreamPlayer.exe")
    If @OSArch = "X64" Then Run(@ScriptDir & "\BlackEyes StreamPlayerX64.exe")
    Else
    MsgBox(64, "Update!", "Es ist eine Neue Version verfügbar!")
    $fg = MsgBox(4, "Updaten?", "Möchtest du jetzt Updaten?")
    If $fg = 6 Then
    HttpSetUserAgent('Firefox')
    $Form1 = GUICreate("Update herunterladen", 295, 133, 193, 125)
    $Progress1 = GUICtrlCreateProgress(20, 56, 260, 17)
    $Label1 = GUICtrlCreateLabel("Update ...", 20, 37, 260, 17)
    GUISetState(@SW_SHOW)
    $Source = $line2
    $aFile = StringSplit($Source, "/")
    Local $dest = @ScriptDir & "\" & $aFile[$aFile[0]]
    ConsoleWrite($dest & @CRLF)
    Local $nBytes, $nSize = InetGetSize($Source)
    Local $hDownload = InetGet($Source, $dest, 1, 1)

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

    Do
    Sleep(1000)
    $nBytes = InetGetInfo($hDownload, 0)
    $ipercent = Floor($nBytes / $nSize * 100)
    GUICtrlSetData($Progress1, $ipercent)
    GUICtrlSetData($Label1, $nBytes & " von " & $nSize & " Bytes = " & $ipercent & "% geladen")
    Until InetGetInfo($hDownload, 2) ; Check if the download is complete.
    Local $aData = InetGetInfo($hDownload) ; Get all information.
    InetClose($hDownload) ; Close the handle to release resourcs.
    MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _
    "Size: " & $aData[1] & @CRLF & _
    "Complete?: " & $aData[2] & @CRLF & _
    "Successful?: " & $aData[3] & @CRLF & _
    "@error: " & $aData[4] & @CRLF & _
    "@extended: " & $aData[5] & @CRLF)

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

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

    [/autoit]

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

  • Beide Probleme leider noch da.

    Spoiler anzeigen
    [autoit]

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

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

    Dim $ver = "2.0"
    HttpSetUserAgent('Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10')
    If @OSArch = "X64" Then
    InetGet("http://molaynox.bplaced.net/UpdateX64.txt",@ScriptDir & "\Tmp\UpdateX64.txt", 1, 0)
    $file = FileOpen(@Scriptdir & "\Tmp\update.txt", 0)
    $line = FileReadLine($file, 1)
    $line2 = FileReadLine($file, 2)
    EndIf
    If @OSArch = "X86" Then
    InetGet("http://molaynox.bplaced.net/Update.txt",@ScriptDir & "\Tmp\Update.txt", 1, 0)
    $file = FileOpen(@Scriptdir & "\Tmp\update.txt", 0)
    $line = FileReadLine($file, 1)
    $line2 = FileReadLine($file, 2)
    EndIf
    If $line = $ver Then
    MsgBox(64, "Kein Update", "Du hast die neuste Version: (" & $ver & ")")
    FileClose($file)
    FileDelete(@Scriptdir & "\Tmp\Update.txt")
    If @OSArch = "X86" Then Run(@ScriptDir & "\BlackEyes StreamPlayer.exe")
    If @OSArch = "X64" Then Run(@ScriptDir & "\BlackEyes StreamPlayerX64.exe")
    Else
    MsgBox(64, "Update!", "Es ist eine Neue Version verfügbar!")
    $fg = MsgBox(4, "Updaten?", "Möchtest du jetzt Updaten?")
    If $fg = 6 Then
    HttpSetUserAgent('Firefox')
    $Form1 = GUICreate("Update herunterladen", 295, 133, 193, 125)
    $Progress1 = GUICtrlCreateProgress(20, 56, 260, 17)
    $Label1 = GUICtrlCreateLabel("Update ...", 20, 37, 260, 17)
    GUISetState(@SW_SHOW)
    $Source = $line2
    $aFile = StringSplit($Source, "/")
    Local $dest = @ScriptDir & "\" & $aFile[$aFile[0]]
    ConsoleWrite($dest & @CRLF)
    Local $nBytes, $nSize = InetGetSize($Source)
    Local $hDownload = InetGet($Source, $dest, 1, 1)

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

    Do
    Sleep(1000)
    $nBytes = InetGetInfo($hDownload, 0)
    $ipercent = Floor($nBytes / $nSize * 100)
    GUICtrlSetData($Progress1, $ipercent)
    GUICtrlSetData($Label1, $nBytes & " von " & $nSize & " Bytes = " & $ipercent & "% geladen")
    Until InetGetInfo($hDownload, 2) ; Check if the download is complete.
    Local $aData = InetGetInfo($hDownload) ; Get all information.
    InetClose($hDownload) ; Close the handle to release resourcs.
    MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _
    "Size: " & $aData[1] & @CRLF & _
    "Complete?: " & $aData[2] & @CRLF & _
    "Successful?: " & $aData[3] & @CRLF & _
    "@error: " & $aData[4] & @CRLF & _
    "@extended: " & $aData[5] & @CRLF)

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

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

    [/autoit]
  • Sag mal willst mir veräppeln?

    Die Pfade sind immernoch falsch.

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

  • Das ist ein kleiner Fehler aber nicht das größte Problem. Im Script ist die aktuelle Version immer 2.0 . Daher ist, wenn in der update.txt die Version höher ist, immer ein Update verfügbar.

  • Das ist ein kleiner Fehler aber nicht das größte Problem. Im Script ist die aktuelle Version immer 2.0 . Daher ist, wenn in der update.txt die Version höher ist, immer ein Update verfügbar.

    Ist sie in seinem Beispiel aber nicht. Und dadurch, dass er die .txt nicht runterläd ist seine Abfrage immer falsch und es wird gesagt eine neues Update wäre verfügbar.

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.