Wiederherstellungs Button muss mehrmals betätigt werden

  • Hallo Zusammen
    Bin seit einiger Zeit an diesem Script, dennoch ist mein Know-how noch nicht ganz fortgeschritten.
    gerne möchte ich hier mein momentanes Problem beheben.

    "Der Button Wiederherstellung muss mehrmals gedrückt werden damit die Anwendung weiter geht."

    - Währe offen für Verbesserungen
    - Programmiertechnische Korrekturen.

    Danke euch vilemals
    MC


    Spoiler anzeigen
    [autoit]


    ;#-> MC - 02.04.2009 ------------------------------------------------------------------
    ;
    ; AutoIt Version : 3.3.0.0
    ; Author : Maurizio Caloro
    ;
    ; Programm Namwe : Restore @ Now
    ; Script Version : 1.0
    ;
    ; Script : Globalfunktion
    ; Laptop Images Restore
    ;
    ; Funktionen :
    ; IP Adressierung überprüfen
    ; Pfad auwertung von config.txt
    ; Netzwerkverbindung erstellen
    ; Laptop auswahl
    ; Laptop MAC-adressierung überprüfung
    ; Externe Anwendung für Restore zurücksicherung
    ; Temporäre Logfiles auf RamDrive erstellen
    ;
    ;#-> MC ----------------------------------------------------------------------------
    #include <array.au3>
    #include <file.au3>
    #include <GUIConstantsEx.au3>
    #include <Constants.au3>
    Opt('MustDeclareVars', 1)
    Core()
    Func Core()

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

    Local $aboutitem, $helpmenu, $runnow, $msg, $cfgfile, $path, $info, $speedview, $language, $laptop
    Local $file, $cfgfile, $filelist, $exititem, $section, $config, $list, $pic, $cpu, $os, $office, $nMsg
    Local $result_laptop, $result_os, $result_office, $result_language
    ;/ MAC TEIL
    Local $filename, $found, $array, $text, $macs, $section1
    ;FileRead
    $config = FileOpen("x:\programs\imager\config.txt", 0)
    $path = FileReadLine($config)
    FileClose($config)
    ;Drive Connect
    DriveMapAdd("r:", ""& $path &"", 0, "kkl-luzern\VAT.LaptopRestore", "DABuAWbzRd4VL")

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

    ;NetworkCheck
    If StringRegExpReplace(@IPAddress1, '(.+)\..+', '$1') = '10.1.0' Then
    ;MsgBox(1,"", "Correct")
    Else
    MsgBox(1,"Achtung", "Sie sind nicht mit dem korrekten Netzwerk verbunden." & Chr(10) & _
    "Überprüfen Sie das Netzwerkkabel und versuchen Sie es nochmals.")
    ;SplashTextOn("--> ! Achtung ! < --", "Sie sind nicht mit dem korrekten Netzwerk verbunden."& CHR(10) & CHR(10) & _
    ; "Überprüfen Sie das Netzwerkkabel und versuchen Sie es nochmals.", 580, 100, -1, -1, 0, 0, 14)
    ; Sleep(10000)
    ;SplashOff()
    Exit
    EndIf

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

    ;Laptop.ini Config fileCheck
    If FileExists("r:\laptop.ini") Then
    ProgressOn("Die Anwendung", "-> 'Restore @ Now' wird Initialisiert.", "0 %")
    For $i = 10 to 100 step 10
    ;sleep(1500)
    sleep(1)
    ProgressSet( $i, $i & " %")
    Next
    ProgressSet(100 , "Erstellt", "Start")
    sleep(150)
    ProgressOff()
    ;SplashTextOn("Vorbereitung", "Die Anwendung 'Restore @ Now' wird Initialisiert.", 440, 50, -1, -1, 0, 0, 14)
    ; Sleep(5000)
    ;SplashOff()
    Else
    MsgBox(16, "Netzwerkkabel", "Kein Laufwerk gefunden" & @CRLF & @CRLF & _
    "Überprüfen Sie das Netzwerkkabel und" & @CRLF & _
    "starten Sie gegebenenfalls den Laptop neu" & @CRLF & @CRLF & _
    "Die Anwendung 'Restore @ Now' wird hiermit beendet!")
    Exit
    EndIf

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

    GUICreate("Restore @ Now", 260, 340) ; Fenster Balken
    ;$pic = GUICtrlCreatePic ('x:\programs\imager\kkl.bmp',145 ,93 ,100 ,70)
    $pic = GUICtrlCreatePic ('x:\kkl.bmp',145 ,238 ,105 ,70)

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

    $filelist = GUICtrlCreateMenu("&File")
    $exititem = GUICtrlCreateMenuItem("Exit", $filelist)
    $helpmenu = GUICtrlCreateMenu("&?")
    $info = GUICtrlCreateMenuItem("&Info", $helpmenu)
    $aboutitem = GUICtrlCreateMenuItem("&About", $helpmenu)
    ;$font = "Arial"
    GUISetFont(11, 400, 3) ; Font
    ;GUISetFont(11, 400, 3, $font) ; Font
    ;GUICtrlCreateLabel("Wählen Sie im nachfolgenden Software aufbau Ihre passende konfiguration", 8, 20)

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

    GUICtrlCreateLabel("Ihr Laptop Modell ", 11, 20)
    $laptop = GUICtrlCreateCombo("", 10, 42)
    $section = IniReadSection("r:\laptop.ini", "Modell")
    For $i = 1 To UBound($section) - 1

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

    GUICtrlSetData($laptop, IniRead("r:\laptop.ini", "modell", $i, ""))

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

    Next
    GUICtrlCreateLabel("Ihr Betriebssystem ", 11, 80)
    $os = GUICtrlCreateCombo("", 10, 102)
    $section = IniReadSection("r:\laptop.ini", "Os")

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

    For $i = 1 To UBound($section) - 1

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

    GUICtrlSetData($os, IniRead("r:\laptop.ini", "Os", $i, ""))

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

    Next
    GUICtrlCreateLabel("Ihr Office ", 11, 140)
    $office = GUICtrlCreateCombo("", 10, 162)
    $section = IniReadSection("r:\laptop.ini", "Office")
    For $i = 1 To UBound($section) - 1

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

    GUICtrlSetData($office, IniRead("r:\laptop.ini", "Office", $i, ""))

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

    Next
    GUICtrlCreateLabel("Ihre Sprache ", 11, 200)
    $language = GUICtrlCreateCombo("", 10, 222)
    $section = IniReadSection("r:\laptop.ini", "Language")
    For $i = 1 To UBound($section) - 1

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

    GUICtrlSetData($language, IniRead("r:\laptop.ini", "Language", $i, ""))

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

    Next
    $runnow = GUICtrlCreateButton("Wiederherstellen", 11, 268, 120)

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

    ;GUICtrlSetState(-1, $GUI_FOCUS) ; the focus is on this button
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $runnnow
    If GUICtrlRead($Input1) And GUICtrlRead($Input2) And GUICtrlRead($Input2) Then
    msgbox(0,"","Weiter")
    Else
    msgbox(0,"","Bitte alle felder ausfüllen")
    EndIf
    EndSwitch
    WEnd

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

    Do
    ;While 1

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

    $msg = GUIGetMsg()
    Switch $msg
    ;Case $exititem
    Case $aboutitem
    MsgBox(64, "Über - Restore @ Now", ""&Chr(10)& _
    "E1"&Chr(10)& _
    "6"&Chr(10)&Chr(10)& _
    "Copyright 2009 "&Chr(10)& _
    "Version 1.0"&Chr(10)&Chr(10)& _
    "Ma"&Chr(10)& _
    "Such", 8)
    Case $info
    $cpu=Run('cpu.exe /s', "", @SW_HIDE,$STDOUT_CHILD)
    While 1
    sleep(250)
    $speedview=StdoutRead($cpu)
    If @error Then ExitLoop

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

    MsgBox(64,"SYSINFO", "Computername "& @Computername &"" & CHR(10) & _
    "Adressierung "& @IPAddress1 &"" & CHR(10) & _
    "Betriebssystem "& @OSVersion &"" & CHR(10) & _
    "Windows-Verzeichnis "& @Windowsdir &"" & CHR(10) & _
    "Prozessor-Arch "& @CPUArch &"" & CHR(10) & _
    "Prozessor-Typ "& $speedview)
    Wend
    Case $exititem
    Exit
    EndSwitch

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

    ;---------------------------------------------------------------------------------------->>>>
    ;About Darstellungsanpassung
    ;
    ;Example2()
    ;Func Example2()
    ; Local $gui
    ; $gui = GUICreate("About - Restore @ Now", 250, 400)
    ; GUISetState($WS_EX_LAYERED)
    ; ;$hWnd = GUICreate ('Test')
    ; $idBtn = GUICtrlCreatePic ('KKL.jpg', 20, 20)
    ; GUISetFont(13, 400, 1, $font)
    ; GUICtrlCreateLabel("t AG" & Chr(10) & _
    ; "1" & Chr(10) & _
    ; "6"& Chr(10) & Chr(10) & _
    ; "Cop" & Chr(10) & _
    ; "M" & Chr(10) & _
    ; "V", 10, 180, 320)
    ; GUISetFont(14, 400, 1, $font)
    ; GUICtrlCreateLabel("", 20, 200, 330)
    ; GUISetState ($WS_EX_LAYERED)
    ;EndFunc
    ; While True
    ; Switch GUIGetMsg ()
    ; Case -3
    ; Exit
    ; Case $idBtn
    ; MsgBox (266304, 'Test', 'Der Button wurde gedrückt ...')
    ; EndSwitch
    ; WEnd
    ;---------------------------------------------------------------------------------------->>>>
    StringInStr(@IPAddress1, "2.")

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

    If $msg = $runnow Then

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

    ; START MAC
    $filename = "b:\ipconfig.txt"
    ;MsgBox(64, "Info", "Laptop Model: " & GUICtrlRead($laptop) & Chr(10) & _
    ;"IP-Adresse: " & @IPAddress1 & Chr(10) & Chr(10) & _
    ;"Klicken Sie < OK > zum Starten der Wiederherstellung ")
    ;& Chr(10) & _ "Klicken Sie < Abbrechen > zum Abbrechen der Anwendung")

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

    ; Mit ipconfig Mac auslesen
    RunWait(@ComSpec & " /c ipconfig /all > " & $filename, "", @SW_HIDE)
    Dim $array
    _FileReadToArray($filename, $array)
    $text = _ArrayToString($array, ";")

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

    $result_laptop = IniRead("r:\laptop.ini", "Result_Laptop",""&GuiCtrlRead($laptop)&"", "")
    $result_os = IniRead("r:\laptop.ini", "Result_Os",""&GuiCtrlRead($os)&"", "")
    $result_office = IniRead("r:\laptop.ini", "Result_Office",""&GuiCtrlRead($office)&"", "")
    $result_language = IniRead("r:\laptop.ini", "Result_Language",""&GuiCtrlRead($language)&"", "")

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

    MsgBox(4096, "Result", $result_laptop&$result_os&$result_office&$result_language)
    MsgBox(1, "", GUICtrlRead($laptop)) ; uberprüfung des gewählten laptop

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

    ;MsgBox(1, "", GUICtrlRead($laptop)&GUICtrlRead($os)&GUICtrlRead($office)&GUICtrlRead($language)) ; uberprüfung des gewählten laptop
    ;MsgBox(1, "", GUICtrlRead($laptop)) ; uberprüfung des gewählten laptop
    ;$section1 = IniReadSection("r:\laptop.ini", ""&GuiCtrlRead($laptop)&"" )
    $section1 = IniReadSection("r:\laptop.ini", ""&GuiCtrlRead($laptop)&"" )
    ;$section1 = IniReadSection("r:\laptop.ini", ""&GuiCtrlRead($laptop)&"" )
    If @error Then
    MsgBox(4096, "Kein Laufwerk "&GUICtrlRead($laptop), _
    "Es ist ein Fehler aufgetreten. Wahrscheinlich keine INI Datei vorhanden.")
    Else
    ;_ArrayDisplay($section1)
    EndIf
    $macs = StringRegExp($text, "(..-..-..-..-..-..)", 3)
    ;_ArrayDisplay($macs)

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

    For $y = 1 To UBound($section1) - 1
    For $j = 0 To UBound($macs) - 1
    If $section1[$y][1] = $macs[$j] Then
    $found = $macs[$j]
    ExitLoop
    EndIf
    Next
    Next
    ; Ausgabe
    If $found <> "" Then
    ;SplashTextOn("MAC-AdresseCheck", "Ihre MAC-Adresse wurde erkannt (" & $found & ") Die Rücksicherung wird gestartet.", 722, 50, -1, -1, 0, 0, 12)
    Sleep(50)
    ;SplashOff()
    Else
    MsgBox(0, "Autorisierung fehlgeschlagen", "Es wurde kein registrierter Laptop gefunden."& CHR(10) & _
    "Die Anwendung wird hiermit beendet."& CHR(10) & CHR(10) & _
    "Bei weiteren Fragen wenden Sie sich an <[email='Support.it@kkl-luzern.ch'][/email]>.")
    FileDelete($filename)
    Exit
    EndIf
    ; temporäre Datei löschen
    FileDelete($filename)
    ; STOP MAC
    If $msg = 2 Then Exit

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

    Sleep(Random(1000, 3000))

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

    $cfgfile = FileOpen("b:\" & GUICtrlRead($laptop) & ".cfg", 1)
    FileWriteLine($cfgfile, "; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
    FileWriteLine($cfgfile, "; * -- Restorescript aus Laptop.ini | Zeit " & @HOUR & ":" & @MIN & ":" & @SEC & " ---> Datum " & @MDAY & "." & @MON & "." & @YEAR & " -- *")
    FileWriteLine($cfgfile, "; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
    FileWriteLine($cfgfile, "mouse=no")
    FileWriteLine($cfgfile, "filesystem=ntfs")
    FileWriteLine($cfgfile, "disk=0")
    FileWriteLine($cfgfile, "main_part=1")
    FileWriteLine($cfgfile, "def_level=6")
    FileWriteLine($cfgfile, "quit=nobadsector")
    FileWriteLine($cfgfile, "automatic_naming=yes")
    FileWriteLine($cfgfile, "file=r:\" & GUICtrlRead($laptop))
    FileClose($cfgfile)
    Sleep(Random(1000, 2000))
    $file = FileOpen("b:\Restoremenow.cmd", 1)
    FileWriteLine($file, "REM * * * * * * * * * * * * * * * * * * * * * * *")
    FileWriteLine($file, "REM * --- Zeit " & @HOUR & ":" & @MIN & ":" & @SEC & " -> Datum " & @MDAY & "." & @MON & "." & @YEAR & " --- *")
    FileWriteLine($file, "REM * * * * * * * * * * * * * * * * * * * * * * *")
    ;FileWriteLine($file, "spartwin.exe -r -f b:\" & GUICtrlRead($laptop) & ".cfg")
    FileWriteLine($file, "x:\programs\imager\spartwin.exe -r -f b:\" & GUICtrlRead($laptop) & ".cfg")
    FileClose($file)
    Sleep(Random(1000, 1500))
    RunWait("b:\Restoremenow.cmd", "", @SW_MAXIMIZE)
    FileMove("b:\" & GUICtrlRead($laptop) & ".cfg", "b:\" & GUICtrlRead($laptop) & ".txt")
    FileMove("b:\Restoremenow.cmd", "b:\Restoremenow.txt")
    MsgBox(0, "Finish Restore", "Restore konnte erfolgreich installiert werden.")
    Exit
    EndIf
    Until $msg = $GUI_EVENT_CLOSE
    EndFunc

    [/autoit]


    noch das passende INI file.

    Spoiler anzeigen
    [autoit]

    [Modell]
    1=Lenovo_Z60M
    2=Lenovo_Z61M
    3=IBM
    4=ACER
    [Os]
    1=Windows_2000
    2=WIndows_XP
    3=Windows_7
    [Office]
    1=Office_2003
    2=Office_2007
    3=Office_2010
    [Language]
    1=German
    2=Englisch
    ------------------------------------------------------------->>> MAC Adressfilterin
    [Lenovo_Z60M]
    KKLLuzern_1=00-16-36-0B-66-29
    KKLLuzern_2=00-16-36-0B-63-9A
    KKLLuzern_3=00-16-36-0B-65-CE
    KKLLuzern_4=00-1B-24-3F-D4-B2
    VMWARE-MAUR=00-0C-29-C2-1E-3F # Disable
    ------------------------------------------------------------->>> Result from Userselection
    [Result_Laptop]
    Lenovo_Z60M=Z60
    Lenovo_Z61M=Z61
    IBM=IBM
    ACER=ACE
    [Result_Os]
    Windows_2000=W2k
    WIndows_XP=wXP
    Windows_7=W_7
    [Result_Office]
    Office_2003=O03
    Office_2007=O07
    Office_2010=O10
    [Result_Language]
    German=ger
    Englisch=eng

    [/autoit]
    • Offizieller Beitrag

    Dein Script läuft bei mir leider nicht, habe aber eine Fehler in Zeile 134 gefunden es sollte Case $runnow anstatt Case $runnnow heißen.

    $runnnow wurde niemals deklariert. ;)

  • Hallo mauric,

    du verwendest mehrere Schleifen mit GuiGetMsg. Dies ist aber bei nur einer Gui nur 1 mal zulässig. So sollte es klappen:

    Spoiler anzeigen
    [autoit]

    ;#-> MC - 02.04.2009 ------------------------------------------------------------------
    ;
    ; AutoIt Version : 3.3.0.0
    ; Author : Maurizio Caloro
    ;
    ; Programm Namwe : Restore @ Now
    ; Script Version : 1.0
    ;
    ; Script : Globalfunktion
    ; Laptop Images Restore
    ;
    ; Funktionen :
    ; IP Adressierung überprüfen
    ; Pfad auwertung von config.txt
    ; Netzwerkverbindung erstellen
    ; Laptop auswahl
    ; Laptop MAC-adressierung überprüfung
    ; Externe Anwendung für Restore zurücksicherung
    ; Temporäre Logfiles auf RamDrive erstellen
    ;
    ;#-> MC ----------------------------------------------------------------------------
    #include <array.au3>
    #include <file.au3>
    #include <GUIConstantsEx.au3>
    #include <Constants.au3>
    Opt('MustDeclareVars', 1)
    Global $Input1, $Input2
    Global $aboutitem, $helpmenu, $runnow, $msg, $cfgfile, $path, $info, $speedview, $language, $laptop
    Global $file, $cfgfile, $filelist, $exititem, $section, $config, $list, $pic, $cpu, $os, $office, $nMsg
    Global $result_laptop, $result_os, $result_office, $result_language

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

    Core()

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

    Func Core()

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

    ;FileRead
    $config = FileOpen("x:\programs\imager\config.txt", 0)
    $path = FileReadLine($config)
    FileClose($config)
    ;Drive Connect
    DriveMapAdd("r:", "" & $path & "", 0, "kkl-luzern\VAT.LaptopRestore", "DABuAWbzRd4VL")

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

    ;NetworkCheck
    If StringRegExpReplace(@IPAddress1, '(.+)\..+', '$1') = '10.1.0' Then
    ;MsgBox(1,"", "Correct")
    Else
    MsgBox(1, "Achtung", "Sie sind nicht mit dem korrekten Netzwerk verbunden." & Chr(10) & _
    "Überprüfen Sie das Netzwerkkabel und versuchen Sie es nochmals.")
    ;SplashTextOn("--> ! Achtung ! < --", "Sie sind nicht mit dem korrekten Netzwerk verbunden."& CHR(10) & CHR(10) & _
    ; "Überprüfen Sie das Netzwerkkabel und versuchen Sie es nochmals.", 580, 100, -1, -1, 0, 0, 14)
    ; Sleep(10000)
    ;SplashOff()
    Exit
    EndIf

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

    ;Laptop.ini Config fileCheck
    If FileExists("r:\laptop.ini") Then
    ProgressOn("Die Anwendung", "-> 'Restore @ Now' wird Initialisiert.", "0 %")
    For $i = 10 To 100 Step 10
    ;sleep(1500)
    Sleep(1)
    ProgressSet($i, $i & " %")
    Next
    ProgressSet(100, "Erstellt", "Start")
    Sleep(150)
    ProgressOff()
    ;SplashTextOn("Vorbereitung", "Die Anwendung 'Restore @ Now' wird Initialisiert.", 440, 50, -1, -1, 0, 0, 14)
    ; Sleep(5000)
    ;SplashOff()
    Else
    MsgBox(16, "Netzwerkkabel", "Kein Laufwerk gefunden" & @CRLF & @CRLF & _
    "Überprüfen Sie das Netzwerkkabel und" & @CRLF & _
    "starten Sie gegebenenfalls den Laptop neu" & @CRLF & @CRLF & _
    "Die Anwendung 'Restore @ Now' wird hiermit beendet!")
    Exit
    EndIf

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

    GUICreate("Restore @ Now", 260, 340) ; Fenster Balken
    ;$pic = GUICtrlCreatePic ('x:\programs\imager\kkl.bmp',145 ,93 ,100 ,70)
    $pic = GUICtrlCreatePic('x:\kkl.bmp', 145, 238, 105, 70)

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

    $filelist = GUICtrlCreateMenu("&File")
    $exititem = GUICtrlCreateMenuItem("Exit", $filelist)
    $helpmenu = GUICtrlCreateMenu("&?")
    $info = GUICtrlCreateMenuItem("&Info", $helpmenu)
    $aboutitem = GUICtrlCreateMenuItem("&About", $helpmenu)
    ;$font = "Arial"
    GUISetFont(11, 400, 3) ; Font
    ;GUISetFont(11, 400, 3, $font) ; Font
    ;GUICtrlCreateLabel("Wählen Sie im nachfolgenden Software aufbau Ihre passende konfiguration", 8, 20)

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

    GUICtrlCreateLabel("Ihr Laptop Modell ", 11, 20)
    $laptop = GUICtrlCreateCombo("", 10, 42)
    $section = IniReadSection("r:\laptop.ini", "Modell")
    For $i = 1 To UBound($section) - 1

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

    GUICtrlSetData($laptop, IniRead("r:\laptop.ini", "modell", $i, ""))

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

    Next
    GUICtrlCreateLabel("Ihr Betriebssystem ", 11, 80)
    $os = GUICtrlCreateCombo("", 10, 102)
    $section = IniReadSection("r:\laptop.ini", "Os")

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

    For $i = 1 To UBound($section) - 1

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

    GUICtrlSetData($os, IniRead("r:\laptop.ini", "Os", $i, ""))

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

    Next
    GUICtrlCreateLabel("Ihr Office ", 11, 140)
    $office = GUICtrlCreateCombo("", 10, 162)
    $section = IniReadSection("r:\laptop.ini", "Office")
    For $i = 1 To UBound($section) - 1

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

    GUICtrlSetData($office, IniRead("r:\laptop.ini", "Office", $i, ""))

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

    Next
    GUICtrlCreateLabel("Ihre Sprache ", 11, 200)
    $language = GUICtrlCreateCombo("", 10, 222)
    $section = IniReadSection("r:\laptop.ini", "Language")
    For $i = 1 To UBound($section) - 1

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

    GUICtrlSetData($language, IniRead("r:\laptop.ini", "Language", $i, ""))

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

    Next
    $runnow = GUICtrlCreateButton("Wiederherstellen", 11, 268, 120)

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

    ;GUICtrlSetState(-1, $GUI_FOCUS) ; the focus is on this button
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $runnow
    If GUICtrlRead($Input1) And GUICtrlRead($Input2) And GUICtrlRead($Input2) Then
    MsgBox(0, "", "Weiter")
    _RunNow()
    Else
    MsgBox(0, "", "Bitte alle felder ausfüllen")
    EndIf
    ;Case $exititem
    Case $aboutitem
    MsgBox(64, "Über - Restore @ Now", "" & Chr(10) & _
    "E1" & Chr(10) & _
    "6" & Chr(10) & Chr(10) & _
    "Copyright 2009 " & Chr(10) & _
    "Version 1.0" & Chr(10) & Chr(10) & _
    "Ma" & Chr(10) & _
    "Such", 8)
    Case $info
    $cpu = Run('cpu.exe /s', "", @SW_HIDE, $STDOUT_CHILD)
    While 1
    Sleep(250)
    $speedview = StdoutRead($cpu)
    If @error Then ExitLoop

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

    MsgBox(64, "SYSINFO", "Computername " & @ComputerName & "" & Chr(10) & _
    "Adressierung " & @IPAddress1 & "" & Chr(10) & _
    "Betriebssystem " & @OSVersion & "" & Chr(10) & _
    "Windows-Verzeichnis " & @WindowsDir & "" & Chr(10) & _
    "Prozessor-Arch " & @CPUArch & "" & Chr(10) & _
    "Prozessor-Typ " & $speedview)
    WEnd
    Case $exititem
    Exit
    ;---------------------------------------------------------------------------------------->>>>
    ;About Darstellungsanpassung
    ;
    ;Example2()
    ;Func Example2()
    ; Local $gui
    ; $gui = GUICreate("About - Restore @ Now", 250, 400)
    ; GUISetState($WS_EX_LAYERED)
    ; ;$hWnd = GUICreate ('Test')
    ; $idBtn = GUICtrlCreatePic ('KKL.jpg', 20, 20)
    ; GUISetFont(13, 400, 1, $font)
    ; GUICtrlCreateLabel("t AG" & Chr(10) & _
    ; "1" & Chr(10) & _
    ; "6"& Chr(10) & Chr(10) & _
    ; "Cop" & Chr(10) & _
    ; "M" & Chr(10) & _
    ; "V", 10, 180, 320)
    ; GUISetFont(14, 400, 1, $font)
    ; GUICtrlCreateLabel("", 20, 200, 330)
    ; GUISetState ($WS_EX_LAYERED)
    ;EndFunc
    ; While True
    ; Switch GUIGetMsg ()
    ; Case -3
    ; Exit
    ; Case $idBtn
    ; MsgBox (266304, 'Test', 'Der Button wurde gedrückt ...')
    ; EndSwitch
    ; WEnd
    ;---------------------------------------------------------------------------------------->>>>
    StringInStr(@IPAddress1, "2.")

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

    EndSwitch
    WEnd
    EndFunc ;==>Core

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

    Func _RunNow()
    ; START MAC
    ;/ MAC TEIL
    Local $filename, $found, $array, $text, $macs, $section1
    $filename = "b:\ipconfig.txt"
    ;MsgBox(64, "Info", "Laptop Model: " & GUICtrlRead($laptop) & Chr(10) & _
    ;"IP-Adresse: " & @IPAddress1 & Chr(10) & Chr(10) & _
    ;"Klicken Sie < OK > zum Starten der Wiederherstellung ")
    ;& Chr(10) & _ "Klicken Sie < Abbrechen > zum Abbrechen der Anwendung")

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

    ; Mit ipconfig Mac auslesen
    RunWait(@ComSpec & " /c ipconfig /all > " & $filename, "", @SW_HIDE)
    Dim $array
    _FileReadToArray($filename, $array)
    $text = _ArrayToString($array, ";")

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

    $result_laptop = IniRead("r:\laptop.ini", "Result_Laptop", "" & GUICtrlRead($laptop) & "", "")
    $result_os = IniRead("r:\laptop.ini", "Result_Os", "" & GUICtrlRead($os) & "", "")
    $result_office = IniRead("r:\laptop.ini", "Result_Office", "" & GUICtrlRead($office) & "", "")
    $result_language = IniRead("r:\laptop.ini", "Result_Language", "" & GUICtrlRead($language) & "", "")

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

    MsgBox(4096, "Result", $result_laptop & $result_os & $result_office & $result_language)
    MsgBox(1, "", GUICtrlRead($laptop)) ; uberprüfung des gewählten laptop

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

    ;MsgBox(1, "", GUICtrlRead($laptop)&GUICtrlRead($os)&GUICtrlRead($office)&GUICtrlRead($language)) ; uberprüfung des gewählten laptop
    ;MsgBox(1, "", GUICtrlRead($laptop)) ; uberprüfung des gewählten laptop
    ;$section1 = IniReadSection("r:\laptop.ini", ""&GuiCtrlRead($laptop)&"" )
    $section1 = IniReadSection("r:\laptop.ini", "" & GUICtrlRead($laptop) & "")
    ;$section1 = IniReadSection("r:\laptop.ini", ""&GuiCtrlRead($laptop)&"" )
    If @error Then
    MsgBox(4096, "Kein Laufwerk " & GUICtrlRead($laptop), _
    "Es ist ein Fehler aufgetreten. Wahrscheinlich keine INI Datei vorhanden.")
    Else
    ;_ArrayDisplay($section1)
    EndIf
    $macs = StringRegExp($text, "(..-..-..-..-..-..)", 3)
    ;_ArrayDisplay($macs)

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

    For $y = 1 To UBound($section1) - 1
    For $j = 0 To UBound($macs) - 1
    If $section1[$y][1] = $macs[$j] Then
    $found = $macs[$j]
    ExitLoop
    EndIf
    Next
    Next
    ; Ausgabe
    If $found <> "" Then
    ;SplashTextOn("MAC-AdresseCheck", "Ihre MAC-Adresse wurde erkannt (" & $found & ") Die Rücksicherung wird gestartet.", 722, 50, -1, -1, 0, 0, 12)
    Sleep(50)
    ;SplashOff()
    Else
    MsgBox(0, "Autorisierung fehlgeschlagen", "Es wurde kein registrierter Laptop gefunden." & Chr(10) & _
    "Die Anwendung wird hiermit beendet." & Chr(10) & Chr(10) & _
    "Bei weiteren Fragen wenden Sie sich an <[email='Support.it@kkl-luzern.ch'][/email]>.")
    FileDelete($filename)
    Exit
    EndIf
    ; temporäre Datei löschen
    FileDelete($filename)
    ; STOP MAC
    ;If $msg = 2 Then Exit

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

    Sleep(Random(1000, 3000))

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

    $cfgfile = FileOpen("b:\" & GUICtrlRead($laptop) & ".cfg", 1)
    FileWriteLine($cfgfile, "; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
    FileWriteLine($cfgfile, "; * -- Restorescript aus Laptop.ini | Zeit " & @HOUR & ":" & @MIN & ":" & @SEC & " ---> Datum " & @MDAY & "." & @MON & "." & @YEAR & " -- *")
    FileWriteLine($cfgfile, "; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
    FileWriteLine($cfgfile, "mouse=no")
    FileWriteLine($cfgfile, "filesystem=ntfs")
    FileWriteLine($cfgfile, "disk=0")
    FileWriteLine($cfgfile, "main_part=1")
    FileWriteLine($cfgfile, "def_level=6")
    FileWriteLine($cfgfile, "quit=nobadsector")
    FileWriteLine($cfgfile, "automatic_naming=yes")
    FileWriteLine($cfgfile, "file=r:\" & GUICtrlRead($laptop))
    FileClose($cfgfile)
    Sleep(Random(1000, 2000))
    $file = FileOpen("b:\Restoremenow.cmd", 1)
    FileWriteLine($file, "REM * * * * * * * * * * * * * * * * * * * * * * *")
    FileWriteLine($file, "REM * --- Zeit " & @HOUR & ":" & @MIN & ":" & @SEC & " -> Datum " & @MDAY & "." & @MON & "." & @YEAR & " --- *")
    FileWriteLine($file, "REM * * * * * * * * * * * * * * * * * * * * * * *")
    ;FileWriteLine($file, "spartwin.exe -r -f b:\" & GUICtrlRead($laptop) & ".cfg")
    FileWriteLine($file, "x:\programs\imager\spartwin.exe -r -f b:\" & GUICtrlRead($laptop) & ".cfg")
    FileClose($file)
    Sleep(Random(1000, 1500))
    RunWait("b:\Restoremenow.cmd", "", @SW_MAXIMIZE)
    FileMove("b:\" & GUICtrlRead($laptop) & ".cfg", "b:\" & GUICtrlRead($laptop) & ".txt")
    FileMove("b:\Restoremenow.cmd", "b:\Restoremenow.txt")
    MsgBox(0, "Finish Restore", "Restore konnte erfolgreich installiert werden.")
    Exit
    EndFunc ;==>_RunNow

    [/autoit]

    eine Variable runnnow (Schreibfehler) ist mit korrigiert
    mfg (Auto)Bert