Setup-Programm-Fehler

  • Was genau hab ich falsch gemacht? Der Link wird aus der heruntergeladenen Ini gelesen, diese Datei aber funktioniert... (Links zensiert)

    Spoiler anzeigen
    [autoit]

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

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

    Global $SA = "S", $Prozent = "0", $Size = "0"

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

    AdlibEnable("_check", 100)

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

    Opt("GUIOnEventMode", 1)
    $Form1 = GUICreate("Installationsassistent", 238, 133, 193, 125)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
    $Edit1 = GUICtrlCreateEdit("", 8, 8, 225, 65, BitOR($ES_READONLY, $ES_WANTRETURN))
    GUICtrlSetData(-1, StringFormat("Herzlich Willkommen beim \r\nInstallationsassistenten für Multivision!\r\nErforderliche Dateien werden aus dem Intenet \r\ngesucht. Bitte warten Sie einen Moment..."))
    $Progress1 = GUICtrlCreateProgress(8, 80, 225, 17)
    $Button1 = GUICtrlCreateButton("Start", 8, 104, 225, 25, 0)
    GUICtrlSetOnEvent(-1, "Button1Click")
    GUISetState(@SW_SHOW)

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

    While 1
    Sleep(100)
    WEnd

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

    Func Button1Click()
    If $SA = "A" Then _exit()
    If $SA = "S" Then _start()
    EndFunc ;==>Button1Click

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

    Func Form1Close()
    _exit()
    EndFunc ;==>Form1Close

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

    Func _exit()
    $iMsgBoxAnswer = MsgBox(292, "Installationsassistent", "Setup wirklich beenden?")
    If $iMsgBoxAnswer = 6 Then Exit
    EndFunc ;==>_exit

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

    Func _start()
    $SA = "A"
    GUICtrlSetData($Button1, "Abbrechen (Vorbereiten...)")
    $Download = InetGet("http://__________setup.ini", @ScriptDir & "\setup.ini", 1)
    $Download = IniRead("setup.ini", "Allgemein", "Haupt", "0")
    If $Download = "0" Then
    $iMsgBoxAnswer = MsgBox(20, "Installationsassistent", "Es wurde kein Downloadlink für die Hauptsetup gefunden." & @CRLF & @CRLF & "Wollen Sie den Link manuell eintippen?")
    If $iMsgBoxAnswer = 6 Then $Download = InputBox("Installationsassistent", "Tippen Sie hier Ihren Link inklusive der Datei (.exe) ein:", "", " ", "-1", "-1", "-1", "-1")
    If $iMsgBoxAnswer = 7 Then Exit
    If @error = 1 Then Exit
    If @error = 3 Then $sToolTipAnswer = ToolTip("Interner Fehler. Programm wird abgebrochen.", Default, Default, "Installationsassistent", 3, 2)
    EndIf
    $Size = InetGetSize($Download)
    $AltProzent = "0"
    InetGet($Download, @ScriptDir & "\install.exe", 1)
    While @InetGetActive
    $Prozent = Round(100 * @InetGetBytesRead / $Size)
    If $Prozent <> $AltProzent Then
    $AltProzent = $Prozent
    GUICtrlSetData($Progress1, $Prozent)
    GUICtrlSetData($Button1, "Abbrechen (" & $Prozent & "%)")
    EndIf
    WEnd
    $Download = MsgBox(65, "Installationsassistent", "Sammeln der Informationen abgeschlossen. Starte nun Setup")
    If $Download = 2 Then Exit
    If $Download = 1 Then
    Run("install.exe")
    Exit
    EndIf
    EndFunc ;==>_start

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

    Func _check()
    $msg = GUIGetMsg()
    If $msg = $Button1 Then Button1Click()
    If $msg = $GUI_EVENT_CLOSE Then Form1Close()
    EndFunc ;==>_check

    [/autoit]

    Einmal editiert, zuletzt von MatthiasG. (29. November 2008 um 11:01)

    • Offizieller Beitrag
    Zitat

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »MatthiasG.« (Heute, 11:01)

    Du hast es aber noch nicht geändert!
    AdlibEnable muss weg und die gesamte Funktion "_Check()". Du hast ja auch GUISetOnEvent und GUICtlrSetOnEvent benutzt, deshalb ist das überflüssig.

    Ansonsten kann ich da keinen Fehler entdecken. Oder gibt es eine Fehlermeldung beim ausführen?

  • Ne, der Edit ging über einen Fehler in meinem Beitrag... ICh habe es jetzt geändert, aber der Abbrechen-Button ändert sich nicht.

    Skript:

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Icon=..\Icon.ico
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #cs ----------------------------------------------------------------------------

    Version: 1.0
    Author: Matthias Gianfelice

    Script Function:
    Installation für die Windows Bedienung

    #ce ----------------------------------------------------------------------------

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

    Opt('GUICloseOnESC', 0) ; das drücken der ESC-Taste führt nicht zum beenden des Programms
    Opt('TrayAutoPause', 0) ; das Script nicht pausieren, wenn auf das Tray-Icon geklickt wird
    Opt('TrayMenuMode', 1) ; kein Default-TrayMenü

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

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

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

    Global $SA = "S", $Prozent = "0", $Size = "0"

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

    $Form1 = GUICreate("Installationsassistent", 238, 133, 193, 125)
    $Edit1 = GUICtrlCreateEdit("", 8, 8, 225, 65, BitOR($ES_READONLY, $ES_WANTRETURN))
    GUICtrlSetData(-1, StringFormat("Herzlich Willkommen beim \r\nInstallationsassistenten für Multivision!\r\nErforderliche Dateien werden aus dem Intenet \r\ngesucht. Bitte warten Sie einen Moment..."))
    $Progress1 = GUICtrlCreateProgress(8, 80, 225, 17)
    $Button1 = GUICtrlCreateButton("Start", 8, 104, 225, 25, 0)
    GUISetState(@SW_SHOW)
    AdlibEnable("_check", 1)

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

    While 1
    Sleep(100)
    WEnd

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

    Func _exit()
    $iMsgBoxAnswer = MsgBox(292, "Installationsassistent", "Setup wirklich beenden?")
    If $iMsgBoxAnswer = 6 Then Exit
    EndFunc ;==>_exit

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

    Func _start()
    $SA = "A"
    GUICtrlSetData($Button1, "Abbrechen (Vorbereiten...)")
    $Download = InetGet("http://gianfelice.de/de/Archiv/Programme/Windowsbedienung/setup.ini", @ScriptDir & "\setup.ini", 1)
    If $Download = 0 Then
    $iMsgBoxAnswer = MsgBox(20, "Installationsassistent", "Es wurden keine Downloadinformationen für Setup gefunden." & @CRLF & @CRLF & "Wollen Sie den Link manuell eintippen?")
    If $iMsgBoxAnswer = 6 Then $Download = InputBox("Installationsassistent", "Tippen Sie hier Ihren Link inklusive der Datei (.ini) ein:", "", " ", "-1", "-1", "-1", "-1")
    If $iMsgBoxAnswer = 7 Then Exit
    If @error = 1 Then Exit
    If @error = 3 Then $sToolTipAnswer = ToolTip("Interner Fehler. Programm wird abgebrochen.", Default, Default, "Installationsassistent", 3, 2)
    EndIf
    $Download = IniRead("setup.ini", "Allgemein", "Haupt", "0")
    If $Download = "0" Then
    $iMsgBoxAnswer = MsgBox(20, "Installationsassistent", "Es wurde kein Downloadlink für die Hauptsetup gefunden." & @CRLF & @CRLF & "Wollen Sie den Link manuell eintippen?")
    If $iMsgBoxAnswer = 6 Then $Download = InputBox("Installationsassistent", "Tippen Sie hier Ihren Link inklusive der Datei (.exe) ein:", "", " ", "-1", "-1", "-1", "-1")
    If $iMsgBoxAnswer = 7 Then Exit
    If @error = 1 Then Exit
    If @error = 3 Then $sToolTipAnswer = ToolTip("Interner Fehler. Programm wird abgebrochen.", Default, Default, "Installationsassistent", 3, 2)
    EndIf
    $Size = InetGetSize($Download)
    $AltProzent = "0"
    InetGet($Download, @ScriptDir & "\install.exe", 1)
    While @InetGetActive
    $Prozent = Round(100 * @InetGetBytesRead / $Size)
    If $Prozent <> $AltProzent Then
    $AltProzent = $Prozent
    GUICtrlSetData($Progress1, $Prozent)
    GUICtrlSetData($Button1, "Abbrechen (" & $Prozent & "%)")
    EndIf
    If $Button1 = 1 Then _exit()
    WEnd
    $Download = MsgBox(65, "Installationsassistent", "Sammeln der Informationen abgeschlossen. Starte nun Setup")
    If $Download = 2 Then Exit
    If $Download = 1 Then
    Run("install.exe")
    Exit
    EndIf
    EndFunc ;==>_start

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

    Func _check()
    $msg = GUIGetMsg()

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

    Select
    Case $msg = $Button1
    If $SA = "A" Then _exit()
    If $SA = "S" Then _start()
    Case $msg = $GUI_EVENT_CLOSE
    _exit()
    EndSelect
    EndFunc ;==>_check

    [/autoit]
  • Du musst InetGet im Background laufen lassen, damit das Skript weiterläuft:
    InetGet($Download, @ScriptDir & "\install.exe", 1,1)
    While @InetGetActive [...] WEnd

  • Warum verwendest du eigentlich nicht NSIS oder InnoSetup? Das wäre vermutlich einfacher, sobald man deren Skript-Sprache versteht;)