Update funktion?

  • Moin leute wollte mal fragen wie so eine update funktion geht also ich möchte es so machen das wenn das programm gestartet wird kommt ne MSG blabla neue version usw und wenns keine neue version gibt dann steht drann keine neue version usw... und wenn es eine neue gibt soll er sie downloaden und mit der alten exe ersetzten. Thx im Vorraus mfg Slash

  • Mhh ich verstehe des net X( ich habe die funktion eingebaut aber wie will des nich =(

    hier mein code:

    [autoit]

    #Include <File.au3>
    #include <GUIConstants.au3>
    #Include <Array.au3>

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("....", 625, 448, 249, 206)
    GUISetBkColor(0xA6CAF0)
    $Combo = GUICtrlCreateCombo("", 16, 408, 169, 25)
    GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|10","")
    $Group1 = GUICtrlCreateGroup("....", 8, 392, 185, 49)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Button1 = GUICtrlCreateButton("...", 200, 400, 129, 41, 0)
    $Button2 = GUICtrlCreateButton("Exit", 488, 400, 129, 41, 0)
    $Button3 = GUICtrlCreateButton("...", 336, 400, 129, 41, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

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

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

    ;~ Updaten
    $ver = "1.0.0"
    InetGet("http://slash126.sl.ohost.de/update.txt",@TempDir & "\update.txt", 1, 0)
    $file = FileOpen(@TempDir & "\update.txt", 0)
    $line = FileReadLine($file, 1)
    If $line = $ver Then
    FileClose($file)
    FileDelete(@TempDir & "\update.txt")
    Else
    MsgBox(64, "Update!", "Es ist eine Neue Version verfügbar!")
    InetGet("http://slash126.sl.ohost.de/" & $line & ".exe", "Lol " & $line & ".exe", 1, 0)
    FileClose($file)
    FileDelete(@TempDir & "\update.txt")
    Exit 0
    EndIf

    [/autoit]
  • Erst mal:
    Du musst die Funktion verstehen.
    -Download update.txt
    -Version einlesen.
    -Wenn ungleich alter Version: Download von Versionsstring.exe ( die gibt es bei dir auf dem Server aber gar nicht.

    2) Du hast einfach den Code nach der Schleife eingefügt. Dort wird er aber ja nie ausgeführt...

  • Hallo.

    Ich habe das mal wie folgt getestet und so funktioniert es:

    Spoiler anzeigen
    [autoit]


    #Include <File.au3>
    #include <GUIConstants.au3>
    #Include <Array.au3>

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

    ;~ Updaten
    $ver = "1.0.0"
    InetGet("http://www.musterseite.de/update.txt",@TempDir & "\update.txt", 1, 0) ; ANPASSEN
    $file = FileOpen(@TempDir & "\update.txt", 0)
    $line = FileReadLine($file, 1)
    If $line = $ver Then
    FileClose($file)
    FileDelete(@TempDir & "\update.txt")
    Else
    MsgBox(64, "Update!", "Es ist eine Neue Version verfügbar!")
    InetGet("http://www.musterseite.de/" & "test.exe", "test.exe", 1, 0) ; ANPASSEN
    FileClose($file)
    FileDelete(@TempDir & "\update.txt")
    Exit 0
    EndIf

    [/autoit]

    meine update.txt auf dem Server sieht wie folgt aus:

    Spoiler anzeigen
    [autoit]


    1.0.1

    [/autoit]

    Sollte Dir helfen.

    Ansonsten einfach nachfragen.

    Einen sommerlichen Gruß, Crazy-A.

    Lieben Gruß,
    Alina

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

    Geheime Information: ;)
    k3mrwmIBHejryPvylQSFieDF5f3VOnk6iLAVBGVhKQegrFuWr3iraNIblLweSW4WgqI0SrRbS7U5jI3sn50R4a15Cthu1bEr

    • Offizieller Beitrag
    Zitat von slash

    Tolle hilfe .....

    Ich kann guten Gewissens sagen, dass es hier "Tolle Hilfe" gibt. Nur halt nicht, wenn keine Eigenleistung (Suche) erkennbar ist und die Probleme nicht sachlich und komplett geschildert werden (Fehlerbeschreibung).

    Also bitte zuerst an die eigene Nase fassen 8)

    peethebee

  • aLSO ERSTMAL GIBT ES HIER DIE BESTE hILFE üBERHAUPT BEI ANDEREN fOREN WARTESTE 2-3 tage auf ne Antwort ne nur so zur info
    also zu deinem Problem ich weis nicht ob dir meine update funktion da hilft aber ich poste sie mal
    es handelt sich dabei um einen game Launcher für ein rollenspiel namens Kalonline
    der updater ist relativ einfach gehalten die anhänge die du evtl. brauchst kann ich anhängen wenn ich zuhause bin ok
    aber die Funktion an sich poste ich mal eben

    Mfg LogiVidia


    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <ComboConstants.au3>
    #include <ListViewConstants.au3>
    #include <StaticConstants.au3>
    #include <ButtonConstants.au3>
    #include <ListBoxConstants.au3>
    #include <TabConstants.au3>
    #include <EditConstants.au3>
    #include <DateTimeConstants.au3>
    #include <SliderConstants.au3>
    #include <TreeViewConstants.au3>
    #include <ProgressConstants.au3>
    #include <AVIConstants.au3>
    #include <UpDownConstants.au3>
    #include<Array.au3>
    #include<File.au3>
    #include <WinAPI.au3>
    #NoTrayIcon
    $IpRead123 = FileReadLine("Launcher.txt", 6)
    $file = InetGetSize($IpRead123 & "/UpdateVersion.txt")
    If @error Then
    FileInstall("BG1.jpg",@TempDir & "\BG1.jpg")
    FileInstall("Start.jpg",@TempDir & "\Start.jpg")
    FileInstall("Options.jpg",@TempDir & "\Options.jpg")
    FileInstall("Website.jpg",@TempDir & "\Website.jpg")
    FileInstall("Close.jpg",@TempDir & "\Close.jpg")
    $Lname = FileReadLine("Launcher.txt",2)
    $notice = FileRead("notice.txt")
    $HTT = FileReadLine("Launcher.txt",4)
    $Form1 = GUICreate($Lname, 550, 300, -1, -1,$WS_POPUP)
    $Pic2 = GUICtrlCreatePic(@TempDir & "\Start.jpg", 38, 265, 130, 30, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Pic3 = GUICtrlCreatePic(@TempDir & "\Options.jpg", 212, 265, 130, 30, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Pic4 = GUICtrlCreatePic(@TempDir & "\Website.jpg", 382, 265, 130, 30, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Pic5 = GUICtrlCreatePic(@TempDir & "\Close.jpg", 532, 0, 20, 20, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Pic1 = GUICtrlCreatePic(@TempDir & "\BG1.jpg", 0, 0, 550, 300, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS,$Ws_Disabled))
    $Edit1 = GUICtrlCreateEdit("", 38, 168, 474, 89)
    GUICtrlSetData(-1, $notice)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetColor(-1, 0xffffff)
    GUISetState(@SW_SHOW)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Pic2
    _1()
    Case $Pic3
    _2()
    Case $Pic4
    _3()
    Case $Pic5
    _4()
    EndSwitch
    WEnd
    ElseIf $file > 0 Then
    _u ()
    EndIf
    Func _u ()
    $IpRead = FileReadLine("Launcher.txt", 6)
    If FileExists("C:\UpdateVersion.txt") Then
    _Funce ()
    Else
    FileWrite("C:\UpdateVersion.txt", "1234567gdertfderdvbhtt")
    Sleep(1000)
    _Funce ()
    EndIf
    EndFunc
    Func _Funce ()
    $IpRead = FileReadLine("Launcher.txt", 6)
    $Ip2 = ($IpRead)
    $ver = FileRead("C:\UpdateVersion.txt")
    InetGet($Ip2 &"/UpdateVersion.txt",@ScriptDir &"\UpdateVersion.txt")
    $file = FileOpen(@ScriptDir & "\UpdateVersion.txt", 0)
    $line = FileRead($file)
    If $line = $ver Then
    FileClose($file)
    Else
    FileClose($file)
    Sleep(500)
    FileDelete("C:\UpdateVersion.txt")
    Sleep(1000)
    FileCopy(@ScriptDir & "\UpdateVersion.txt", "C:\UpdateVersion.txt")
    ProgressOn("Checking Resource", "Checking Resource")
    Sleep(1000)
    ProgressSet(20, "Checking Resource", "20 %")
    Sleep(1000)
    ProgressSet(50, "Checking Resource", "50 %")
    Sleep(1000)
    ProgressSet(100, "Checking Resource", "100 %")
    Sleep(500)
    ProgressOff()
    _Func ()
    EndIf
    EndFunc
    Func _Func ()
    $IpRead = FileReadLine("Launcher.txt", 6)
    $Ip = ($IpRead)
    Local $meinarray
    InetGet($Ip &"/file.list",@ScriptDir &"\file.list")
    $filename = (@ScriptDir &"\file.list")
    $FILEPATH = (@ScriptDir &"\file.txt")
    $hFile = FileOpen($filename,0)
    _FilereadToArray($filename, $meinarray)
    _FileWriteFromArray($FILEPATH, $meinarray)
    $split = StringRegExp(FileRead(FileOpen(@ScriptDir & '\file.txt', 0)), '(?<=\n|\A).*(?=,)', 3)
    $file = FileOpen("UpdInf.txt",2)
    For $i = 0 To Ubound($split) -1
    FileWrite("UpdInf.txt", $split[$i] & @crlf)
    Next
    $filename1 = @ScriptDir & '\UpdInf.txt'
    $filename2 = @ScriptDir & '\UpdInf2.txt'
    Local $meinarray1
    Local $nLfd
    _FileReadToArray($filename1,$meinarray1)
    For $nLfd = 1 To $meinarray1[0]
    $meinarray1[$nLfd] = StringRegExpReplace($meinarray1[$nLfd],'\\','\/')
    $meinarray1[$nLfd] = StringRegExpReplace($meinarray1[$nLfd],'\./','/')
    Next
    _FileWriteFromArray($filename1,$meinarray1,1,$meinarray1[0])
    $filename1 = @ScriptDir & '\UpdInf.txt'
    $filename2 = @ScriptDir & '\UpdInf2.txt'
    Local $meinarray1
    Local $nLfd
    _FileReadToArray($filename1,$meinarray1)
    For $nLfd = 1 To $meinarray1[0]
    $meinarray1[$nLfd] = StringRegExpReplace($meinarray1[$nLfd],'\/','\\')
    $meinarray1[$nLfd] = StringRegExpReplace($meinarray1[$nLfd],'\.\','\\')
    Next
    _FileWriteFromArray($filename2,$meinarray1,1,$meinarray1[0])
    ProgressOn("Found KalOnline Updates", "KalOnline Update in Progress", "Update",-1,-1,18)
    $filename0 = FileOpen("UpdInf.txt",0)
    $filename3 = FileOpen("UpdInf2.txt",0)
    ProgressSet(0,"0%")
    Local $der
    $der = FileReadLine("file.txt", 1)
    for $i = 1 to $der
    $1 = FileReadLine($filename0,$i)
    $2 = FileReadLine($filename3,$i)
    Inetget($Ip&$1,@ScriptDir &$2)
    $prozent = $i/$der*100
    $prozent = StringSplit($prozent, ".")
    If IsArray($prozent) Then ProgressSet($prozent[1],$2,$prozent[1]&" %")
    Next
    Sleep(200)
    ProgressOff()
    FileClose(@ScriptDir &"UpdInf.txt")
    FileClose(@ScriptDir &"UpdInf2.txt")
    FileClose(@ScriptDir &"file.list")
    FileClose(@ScriptDir &"file.txt")
    FileDelete(@ScriptDir &"UpdInf.txt")
    FileDelete(@ScriptDir &"UpdInf2.txt")
    FileDelete(@ScriptDir &"file.list")
    FileDelete(@ScriptDir &"file.txt")
    MsgBox(0,"Updates", "All Updates Finished", 1)
    Sleep(50)
    MsgBox(0,"Updates", "All Updates Finished", 1)
    Sleep(50)
    MsgBox(0,"Updates", "All Updates Finished", 1)
    Sleep(50)
    EndFunc
    FileInstall("BG1.jpg",@TempDir & "\BG1.jpg")
    FileInstall("Start.jpg",@TempDir & "\Start.jpg")
    FileInstall("Options.jpg",@TempDir & "\Options.jpg")
    FileInstall("Website.jpg",@TempDir & "\Website.jpg")
    FileInstall("Close.jpg",@TempDir & "\Close.jpg")
    $Lname = FileReadLine("Launcher.txt",2)
    $notice = FileRead("notice.txt")
    $HTT = FileReadLine("Launcher.txt",4)
    $Form1 = GUICreate($Lname, 550, 300, -1, -1,$WS_POPUP)
    $Pic2 = GUICtrlCreatePic(@TempDir & "\Start.jpg", 38, 265, 130, 30, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Pic3 = GUICtrlCreatePic(@TempDir & "\Options.jpg", 212, 265, 130, 30, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Pic4 = GUICtrlCreatePic(@TempDir & "\Website.jpg", 382, 265, 130, 30, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Pic5 = GUICtrlCreatePic(@TempDir & "\Close.jpg", 532, 0, 20, 20, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Pic1 = GUICtrlCreatePic(@TempDir & "\BG1.jpg", 0, 0, 550, 300, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS,$Ws_Disabled))
    $Edit1 = GUICtrlCreateEdit("", 38, 168, 474, 89)
    GUICtrlSetData(-1, $notice)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetColor(-1, 0xffffff)
    GUISetState(@SW_SHOW)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Pic2
    _1()
    Case $Pic3
    _2()
    Case $Pic4
    _3()
    Case $Pic5
    _4()
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd
    Func _1 ()
    ShellExecute("engine.exe","/load /config debug")
    Exit
    Endfunc
    Func _3 ()
    ShellExecute($HTT)
    EndFunc
    Func _2 ()
    FileInstall("Reso.exe","Reso.exe")
    MsgBox(0, "Setting", "Here you can change the Game Resolution, other settings please change in Game",4)
    Sleep(500)
    Run("Reso.exe")
    Exit
    EndFunc
    Func _4 ()
    Exit
    Endfunc

    [/autoit]

  • Hallo Crazy-A,

    das Script ist toll, nur wenn ich das ausführe dann springt er immer in den Else Pfad auch wenn die Verion auf dem Server älter ist als die im Programmcode.
    Woran könnte das liegen?