Error übergeben bzw. erstmal bekommen

  • Hallo zusammen,

    ich mach folgendes. Ein Programm liest aus einem Pfad die darin enthaltenen exe-Dateien aus. Diese werden auf einer GUI angezeigt und entsprechend, wenn angehakt, ausgeführt. Diese exe-Dateien installieren jeweils ein Programm. Nun habe ich das Problem, dass ich keine Rückmeldung bekommen, wenn eines dieser Programme bei der Installation abbricht.

    Ich denke mal es geht über

    [autoit]


    seterror()

    [/autoit]


    Das Installations-Script macht nichts anderes, als z.B. in diesem Fall eDocPrintPro zu installieren (PDF Drucker). Der bricht aber ab, weil er schon installiert ist. Aber wie frage ich das ab? Der Errorcode ist immer 0.

    Er schreibt aber was ins Ereignislog (von Windows). Kann ich dass irgendwie auslesen? Und wenn ja, reicht es dann den error zu setzen? Das soll ja weitergegeben werden an das script, was die dateien ausliest bzw. zum Installieren anstößt, damit ich dort ne Nachricht ausgeben kann, dass die Installation fehlgeschlagen ist.

    Alles sehr komplex, ich weiß, ich hoffe ihr versteht, was ich meine und könnt mir hier ein paar Tipps geben.

    Danke schon mal vorab.

    Gruß
    CaptainKacke

  • Sorry für die lange Wartezeit, war ein wenig platt.

    Jetze aber.

    Hier mal das eigentliche Installationsscript:

    Spoiler anzeigen
    [autoit]

    ;--- Allgemeine Einstellungen ---

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

    $admin= "Administrator"
    $password= "passwort"
    $domain= "domain"

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

    ;--- Programmeinstellungen ---
    $path= "\\pfad\zur\datei\eDocPrintPro\"
    $file= "setup.exe"
    $parameter= " /S /norestart"
    $program= "eDocPrintPro 3.13.4"

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

    ;##########################################################################################################################################################################

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

    ;--- Programmstart ---

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

    If Not FileExists($path & $file) Then
    MsgBox(16,"Datei nicht gefunden", "Konnte " & $file & " nicht im Installationsordner finden!")
    EndIf

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

    TrayTip("Installation", $program & " wird installiert!", 5)
    $make = Run($path & $file & $parameter)

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

    ProcessWaitClose($make)

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

    Exit

    [/autoit]

    und hier ist das ähhm, ich nenne es mal "Ausführungsscript". Also dieses Script führt ja eigentlich nur o.g. Script aus...

    Spoiler anzeigen
    [autoit]

    ;--- Includes ---
    #include <File.au3>
    #include <Array.au3>

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

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

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

    ;--- Login Daten ---
    $admin = "Administrator"
    $password = "passwort"
    $domain = "domain"

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

    ;--- Allgemeine Einstellungen ---
    $path = "\\pfad\zur\datei\"

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

    ;--- Variablenzuweisung ---

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

    $left = 20
    $top = 20
    $i = 0
    $extension = "*.exe"

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

    $gui_height = 600
    $gui_width = 800

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

    $mark_all = 0

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

    ;--- Erstellung Arrays ---
    $arFiles = _FileListToArray($path, $extension)

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

    ;~ _ArrayDisplay($arFiles)

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

    ;--- Erstellung Gui ---
    $Gui = GUICreate("AIO Installer v0.3", $gui_width, $gui_height, 220, 150)
    $MenuItem1 = GUICtrlCreateMenu("Datei")
    $MenuItem2 = GUICtrlCreateMenuItem("Beenden", $MenuItem1)
    $button_all_mark = GUICtrlCreateButton("Alles markieren", $left, $gui_height - 60)
    $button_install = GUICtrlCreateButton("Installieren", $left + 100, $gui_height - 60)

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

    GUISetIcon(@ScriptDir & "\images\ico\installer.ico")
    TraySetIcon(@ScriptDir & "\images\ico\installer.ico")
    GUISetState(@SW_SHOW)
    GUISetBkColor(0x99b9e8)

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

    Dim $arCheckBox[UBound($arFiles, 1)][7]

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

    For $i = 1 to UBound($arFiles) - 1
    $arCheckBox[$i - 1][0] = GUICtrlCreateCheckbox($arFiles[$i], $left, $top + 20, 180, 17)
    $arCheckBox[$i - 1][2] = $left
    $arCheckBox[$i - 1][3] = $top
    $arCheckBox[$i - 1][5] = GUICtrlCreateLabel("installiert", $left + 180, $top + 20, 80, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE))
    $arCheckBox[$i - 1][6] = GUICtrlCreateLabel("fehlgeschlagen", $left + 180, $top + 20, 80, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE))
    $top = $top + 20
    GuiCtrlSetBkColor($arCheckBox[$i - 1][5], 0x00FF00)
    GUICtrlSetFont($arCheckBox[$i - 1][5], 8, 800)
    GUICtrlSetState($arCheckBox[$i - 1][5], $GUI_HIDE)

    GuiCtrlSetBkColor($arCheckBox[$i - 1][6], 0xFF0000)
    GUICtrlSetFont($arCheckBox[$i - 1][6], 8, 800)
    GUICtrlSetState($arCheckBox[$i - 1][6], $GUI_HIDE)
    Next

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

    _ArrayDelete($arFiles, 0)

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

    For $a = 0 to UBound($arFiles, 1) - 1
    $arCheckBox[$a][1] = $arFiles[$a]
    Next

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

    _Array2DEmptyDel($arCheckBox)

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

    ;--- Gui Schleife ---
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $MenuItem2
    Exit
    case $button_all_mark
    If $mark_all = 0 Then
    For $x = 0 To UBound($arCheckBox, 1) - 1
    GUICtrlSetState($arCheckBox[$x][0], 1)
    $mark_all = 1
    Next

    ElseIf $mark_all = 1 Then
    For $x = 0 To UBound($arCheckBox, 1) - 1
    GUICtrlSetState($arCheckBox[$x][0], 4)
    $mark_all = 0
    Next
    EndIf
    case $button_install

    Local $arAuswahl[UBound($arCheckBox)]
    Local $arLog[UBound($arCheckBox)]

    $arInstall = $arCheckBox

    For $checked = 0 To UBound($arCheckBox) - 1
    If GUICtrlRead($arCheckBox[$checked][0]) = 1 Then
    $arCheckBox[$checked][4] = "install"
    EndIf
    Next
    For $install = 0 to UBound($arCheckBox) - 1
    If $arCheckBox[$install][4] = "install" Then
    $make = RunAs($admin, $domain, $password,0, $path & $arCheckBox[$install][1])
    ProcessWaitClose($make)
    EndIf
    Next
    EndSwitch
    WEnd

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

    ;--- Funktionen ---

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

    Func _exit()
    Exit
    EndFunc

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

    Func _Array2DInsert(ByRef $avArray, $iElement, $sValue='')
    If ( Not IsArray($avArray) ) Then
    SetError(1)
    Return 0
    EndIf
    Local $UBound2nd = UBound($avArray,2)
    If @error = 2 Then
    Local $arTMP[UBound($avArray)+1]
    If $iElement > UBound($avArray) Then
    SetError(3)
    Return 0
    EndIf
    For $i = 0 To UBound($arTMP)-1
    If $i < $iElement Then
    $arTMP[$i] = $avArray[$i]
    ElseIf $i = $iElement Then
    If $i < UBound($avArray) Then
    $arTMP[$i] = $sValue
    $arTMP[$i+1] = $avArray[$i]
    Else
    $arTMP[$i] = $sValue
    EndIf
    ElseIf ($i > $iElement) And ($i < UBound($avArray))Then
    $arTMP[$i+1] = $avArray[$i]
    EndIf
    Next
    Else
    Local $arTMP[UBound($avArray)+1][$UBound2nd], $arValue
    If $sValue = '' Then
    For $i = 0 To $UBound2nd-2
    $sValue &= '|'
    Next
    EndIf
    $arValue = StringSplit($sValue, '|')
    If $arValue[0] <> $UBound2nd Then
    SetError(2)
    Return 0
    EndIf
    If $iElement > UBound($avArray) Then
    SetError(3)
    Return 0
    EndIf
    For $i = 0 To UBound($arTMP)-1
    If $i < $iElement Then
    For $k = 0 To $UBound2nd-1
    $arTMP[$i][$k] = $avArray[$i][$k]
    Next
    ElseIf $i = $iElement Then
    If $i < UBound($avArray) Then
    For $k = 0 To $UBound2nd-1
    $arTMP[$i][$k] = $arValue[$k+1]
    $arTMP[$i+1][$k] = $avArray[$i][$k]
    Next
    Else
    For $k = 0 To $UBound2nd-1
    $arTMP[$i][$k] = $arValue[$k+1]
    Next
    EndIf
    ElseIf ($i > $iElement) And ($i < UBound($avArray))Then
    For $k = 0 To $UBound2nd-1
    $arTMP[$i+1][$k] = $avArray[$i][$k]
    Next
    EndIf
    Next
    EndIf
    $avArray = $arTMP
    EndFunc

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

    Func _Array2DEmptyDel(ByRef $avArray, $Col=0)
    If ( Not IsArray($avArray) ) Then
    SetError(1)
    Return 0
    EndIf
    Local $UBound2nd = UBound($avArray,2)
    If @error = 2 Then
    Local $arTMP[1]
    For $i = 0 To UBound($avArray)-1
    If StringLen($avArray[$i] > 0) Then
    If StringLen($arTMP[UBound($arTMP)-1]) = 0 Then
    $arTMP[UBound($arTMP)-1] = $avArray[$i]
    Else
    ReDim $arTMP[UBound($arTMP)+1]
    $arTMP[UBound($arTMP)-1] = $avArray[$i]
    EndIf
    EndIf
    Next
    Else
    If $Col = 0 Then
    Local $arTMP[1][$UBound2nd], $val, $len
    For $i = 0 To UBound($avArray)-1
    $val = ''
    For $k = 0 To $UBound2nd-1
    $val &= $avArray[$i][$k]
    Next
    If StringLen($val) > 0 Then
    $len = 0
    For $k = 0 To UBound($arTMP,2)-1
    $len &= StringLen($arTMP[UBound($arTMP)-1][$k])
    Next
    If $len = 0 Then
    For $k = 0 To $UBound2nd-1
    $arTMP[UBound($arTMP)-1][$k] = $avArray[$i][$k]
    Next
    Else
    ReDim $arTMP[UBound($arTMP)+1][$UBound2nd]
    For $k = 0 To $UBound2nd-1
    $arTMP[UBound($arTMP)-1][$k] = $avArray[$i][$k]
    Next
    EndIf
    EndIf
    Next
    Else
    Local $arTMP[UBound($avArray)][1], $val, $len
    For $k = 0 To $UBound2nd-1
    $val = ''
    $notEmpty = 0
    For $i = 0 To UBound($avArray)-1
    $val &= $avArray[$i][$k]
    If StringLen($val) > 0 Then
    $notEmpty = 1
    ExitLoop
    EndIf
    Next
    If $notEmpty = 1 Then
    $len = 0
    For $i = 0 To UBound($arTMP)-1
    $len &= StringLen($arTMP[$i][UBound($arTMP,2)-1])
    Next
    If $len = 0 Then
    For $i = 0 To UBound($avArray)-1
    $arTMP[$i][0] = $avArray[$i][$k]
    Next
    Else
    ReDim $arTMP[UBound($avArray)][UBound($arTMP,2)+1]
    For $i = 0 To UBound($avArray)-1
    $arTMP[$i][UBound($arTMP,2)-1] = $avArray[$i][$k]
    Next
    EndIf
    EndIf
    Next
    EndIf
    EndIf
    $avArray = $arTMP
    Return -1
    EndFunc ;==>_Array2DEmptyDel

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

    Exit

    [/autoit]


    Ob das jetzt so alles richtig ist, wie ich mir das da so zusammengereimt habe ist erstmal zweitrangig. Da kann man bestimmt vieles besser machen.

    Mir geht es nur darum, wie ich die Fehler setzen bzw. abfragen kann und damit dann weiterarbeiten kann.

    Vielen Dank schon mal...


    Gruß
    CaptainKacke