GUI Variable hilfe

  • Hi ich hab mir ein gui gemacht und auf rate ein paar leute Array verwendet nur weis ich nicht mehr was ich bei den Cheakboxen auslesen für eine Variable nehmen muss :(


    Spoiler anzeigen
    [autoit]


    dim $RUN
    dim $EXIT
    dim $Button_1
    dim $APP_CHKBOX[1]
    Dim $i
    Dim $Status1

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

    #include <GUIConstants.au3> ;this is required for a GUI to work

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

    ;This creates the inital GUI box
    ;To Remove any non-needed checkboxes simply remark any of the CHKBOX lines
    GUICreate ("Application Launcher",580,400)
    GUISetFont(14,600)
    GUICtrlCreateLabel("Application Installer",10,5)
    GUISetFont(9,400)

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

    $Apps = stringsplit("Acrobat Reader 7.0.8|Lan Net Scan 3.3|Windows Service Pack 2|Windows Update Pack 2.13|VNC 4.1|VLC Media Player|WinRAR|V-Scan 7.1|V-Scan 8.13|Java 5 SP7|Windows Defender|PDF Creator 0.9|Aufräumen|FireFox|Windows GUI anpassen","|";)
    redim $APP_CHKBOX[$apps[0] +1]
    $top = 10
    for $i = 1 to $apps[0]
    $top = $top + 20
    $APP_CHKBOX[$i] = GUICtrlCreateCheckbox($apps[$i],10,$top);Checkbox 1

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

    Next

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

    $Button_1 = GUICtrlCreateButton ("Select All", 340, 140, 100)
    $Button_2 = GUICtrlCreateButton ( "Desktop Install", 340, 180, 100)
    $Button_3 = GUICtrlCreateButton ("Server Install", 340, 220, 100)
    $Button_4 = GUICtrlCreateButton ( "Laptop Install", 340, 260, 100)
    $Button_5 = GUICtrlCreateButton ( "Clear Checkboxes", 340, 300, 100)
    $RUN = GUICtrlCreateButton("Install",10,350,120,20);This in the Run button
    $EXIT = GUICtrlCreateButton("Exit",450,350,120,20);This causes the application to exit
    GUISetState()

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Exit
    Exit
    Case $Button_1
    for $i = 1 to $apps[0]
    GUICtrlSetState($APP_CHKBOX[$i],$GUI_CHECKED)
    next
    Case $Button_5
    for $i = 1 to $apps[0]
    GUICtrlSetState($APP_CHKBOX[$i],$GUI_UNCHECKED)
    next
    ;~ Switch $Button_1
    ;~ For $i = 1 to 15
    EndSwitch
    WEnd

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

    Do
    $msg = GUIGetMsg()

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

    ;Reads the status of the Checkboxes and sets a variable to either 1 for checked or 4 for not checked
    ;This HAS to be included before the UNTIL statement
    $status1 = GUICtrlRead($APP_CHKBOX[$apps[0])
    $status2 = GUICtrlRead($APP_CHKBOX[$apps[1])
    $status3 = GUICtrlRead()
    $status4 = GUICtrlRead($Apps[4])
    $status5 = GUICtrlRead($Apps[5])
    $status6 = GUICtrlRead($Apps[6])
    $status7 = GUICtrlRead($Apps[7])
    $status8 = GUICtrlRead($Apps[8])
    $status9 = GUICtrlRead($Aapps[9])
    $status10 = GUICtrlRead($Apps[10])
    $status11 = GUICtrlRead($Apps[11])
    $status12 = GUICtrlRead($Apps[12])
    $status13 = GUICtrlRead($Apps[13])
    $status14 = GUICtrlRead($Apps[14])
    $status15 = GUICtrlRead($Apps[15])

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

    Until $msg = $EXIT or $msg = $RUN

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

    If $msg = $EXIT then Exit
    ;Checks the status of the Checkboxes and calls the application function(s) if the checkbox is enabled
    ; Map X drive to \\myserver2\stuff2 using the user "jon" from "domainx" with password "tickle"
    DriveMapAdd("L:", "\\", 0, "", "";)
    IF $status1 = 1 then call ("APP_1";)
    IF $status2 = 1 then call ("APP_1";)
    IF $status3 = 1 then call ("APP_1";)
    IF $status4 = 1 then call ("APP_1";)
    IF $status5 = 1 then call ("APP_1";)
    IF $status6 = 1 then call ("APP_1";)
    IF $status7 = 1 then call ("APP_1";)
    IF $status8 = 1 then call ("APP_1";)
    IF $status9 = 1 then call ("APP_1";)
    IF $status10 = 1 then call ("APP_1";)
    IF $status11 = 1 then call ("APP_1";)
    IF $status12 = 1 then call ("APP_1";)
    IF $status13 = 1 then call ("APP_1";)
    IF $status14 = 1 then call ("APP_1";)
    IF $status15 = 1 then call ("APP_1";)
    Call ("END_APP";)

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

    ;Add Application here
    Func APP_1();Acrobat 7.0.8
    MsgBox(0, "AcrobatReader get installed", "Bitte Warten...", 5)
    Run("c:\test.bat","",@SW_SHOWDEFAULT)
    ProcessWaitClose("cmd.exe";)
    EndFunc

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

    Func APP_2();Lan Net Scan 3.3
    MsgBox(0, "LanNetScan get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
    ProcessWaitClose("lannetscan.exe";)
    EndFunc

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

    Func APP_3();Windows Service Pack 2
    Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
    ProcessWaitClose("update.exe";)
    MsgBox(0, "SP2 ist installiert", "SP2 ist installiert", 5)
    EndFunc

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

    Func APP_4();Windows UpdatePac 2.13
    $inifile = @ScriptDir & "\Software\Updatepack\Data\settings.ini";Phat 2 the Update Ini
    $titel = "Winfuture Update-Pack Silentinstaller"

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

    $main = GUICreate($titel, 410, 270, -1, -1, $WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))

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

    GUICtrlCreateGroup("", 10, 10, 390, 80)
    $lb_vers = GUICtrlCreateLabel("Version", 20, 20, 370)
    $lb_date = GUICtrlCreateLabel("Datum", 20, 40, 370)
    $lb_silent = GUICtrlCreateLabel("Silentinstaller ", 20, 60, 370)

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

    GUICtrlCreateGroup("", 10, 90, 390, 120)
    $lb_anzahl = GUICtrlCreateLabel("", 20, 100, 40)
    $lb_file = GUICtrlCreateLabel("Datei: ", 20, 120, 370)
    $lb_description = GUICtrlCreateLabel("Beschreibung: ", 20, 150, 370, 50)

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

    $progress = GUICtrlCreateProgress(10, 220, 390, 40, $PBS_SMOOTH)
    $step_progress = 0

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

    GUISetState(@SW_SHOW, $main)

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

    ;Auslesen der settings.ini
    $num = IniRead($inifile, "Main", "Files", "";)
    $vers = IniRead($inifile, "Main", "Name", "Es ist etwas schief gelaufen!";)
    $date = IniRead($inifile, "Main", "Version", "Es ist etwas schief gelaufen!";)

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

    GUICtrlSetData($lb_vers, $vers ";)
    GUICtrlSetData($lb_date, $date)
    GUICtrlSetData($lb_anzahl, "0/" & $num)

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

    ;Errechnen der Fortschrittsbalkengeschwindigkeit
    $step = 100 / $num

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

    ;Auslesen der einzelnen Sectionen (1-n)
    ;Gleichzeitiges setzen der Infos und ausführen des Scriptes (unsichtbar)
    For $i = 1 To $num
    $file = IniRead($inifile, "File" & $i, "File", "Es ist etwas schief gelaufen!";)
    $parameter = IniRead($inifile, "File" & $i, "Parameters", "";)
    $description = IniRead($inifile, "File" & $i, "Name", "Es ist etwas schief gelaufen!";)
    GUICtrlSetData($lb_anzahl, $i & "/" & $num)
    GUICtrlSetData($lb_file, $file)
    GUICtrlSetData($lb_description, $description)
    RunWait(@ScriptDir & "\Software\Updatepack\Data\" & $file & " " & $parameter, @ScriptDir, @SW_HIDE)
    $step_progress = $step_progress + $step
    GUICtrlSetData($progress, $step_progress)
    Next
    EndFunc

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

    Func APP_5();VNC 4.1
    MsgBox(0, "VNC get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\VNC\VNC41.exe /silent","",@SW_SHOWDEFAULT)
    ProcessWaitClose("vnc41.exe";)
    Run("regedit /s "& @ScriptDir & "\Software\VNC\VNCOptionen.reg","",@SW_SHOWDEFAULT);VNC Passwort und FirewallPorts
    EndFunc

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

    Func APP_6();VLC Media Player
    MsgBox(0, "VLC get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\VLC\VLC.exe /S","",@SW_SHOWDEFAULT)
    EndFunc

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

    Func APP_7();Winrar
    MsgBox(0, "WinRar get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\WinRar\wrar350d.exe /s","",@SW_SHOWDEFAULT)
    ProcessWaitClose("wrar350d.exe";)
    EndFunc

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

    Func APP_8();V-Scan7.1
    Run(@ScriptDir & "\Software\VScan7.10\setup.exe /quiet /passive","",@SW_SHOWDEFAULT)
    ProcessWaitClose("setup.exe";)
    Superdat()
    EndFunc

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

    Func APP_9();V-Scan 8.13
    MsgBox(0, "V-Scan8 get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\VScan8.13\V-Scan8\setup.exe /passive","",@SW_SHOWDEFAULT)
    ProcessWaitClose("setup.exe";)
    Run(@ScriptDir & "\Software\VScan8.13\Update8.13\setup.exe /passive","",@SW_SHOWDEFAULT)
    ProcessWaitClose("setup.exe";)
    Superdat()
    EndFunc

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

    Func Superdat();Superdat vom 21.09
    Run(@ScriptDir & "\Software\VScan-Superdat\sdat4857.exe /SILENT","",@SW_SHOWDEFAULT)
    EndFunc

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

    Func APP_10();Java 5 Sp7
    Run(@ScriptDir & "\Software\Java\java.exe /S /v/qn","",@SW_SHOWDEFAULT)
    ProcessWaitClose("java.exe";)
    EndFunc

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

    Func APP_11();Windows Defender
    MsgBox(0, "Windows Defender get installed", "Bitte Warten...", 5)
    RunWait("msiexec /i WindowsDefender.msi /qb" , @ScriptDir & "\Software\WindowsDefender";)
    Sleep(1500)
    WinWait("Windows Defender (Beta 2)", "Banner Panel";)
    WinClose("Windows Defender (Beta 2)";)
    EndFunc

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

    Func APP_12();PDF Creator 0.9
    MsgBox(0, "PDF Creator 0.9 get installed", "Bitte Warten...", 5)
    RunWait(@ScriptDir & "\Software\PDFCreator0.9\PDFCreator.msi /verysilent /norestart","",@SW_SHOWDEFAULT)
    ProcessWaitClose("PDFCreator.msi";)
    EndFunc

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

    Func APP_13();Aufräumen
    MsgBox(0, "Time 2 Clean", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\Aufraeum.bat","",@SW_SHOWDEFAULT)
    ProcessWaitClose("Aufraeum.bat";)
    EndFunc

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

    Func APP_14();Firefox
    Run(@ScriptDir & "\Software\FireFox\.exe -ma","",@SW_SHOWDEFAULT)
    EndFunc

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

    Func APP_15();Windows GUI anpassen
    ; Klassisches Startmenü

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

    Run("rundll32.exe shell32.dll,Options_RunDLL 1";)
    WinWait("Eigenschaften von Taskleiste und Startmenü";)
    send("^{tab}";)
    send("!k";)
    send("{enter}";)

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

    ; Desktop einrichten

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

    Run(@COMSPEC & " /c desk.cpl";)
    winwait("Eigenschaften von Anzeige";)
    send("{shiftdown}";)
    send("{tab}";)
    send("{shiftup}";)
    send("{right}";)
    send("!e";)
    winwait("Desktopelemente";)
    send("!e";)
    send("!i";)
    send("!r";)
    send("!d";)
    send("{enter}";)
    winwait("Eigenschaften von Anzeige";)
    send("{enter}";)
    EndFunc

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

    Func END_APP()
    MsgBox(4096,"Complete","All Selected Applications Installed";)
    EndFunc

    [/autoit]


    Ich hoffe das ihr mir weiterhelfen könnt bzw. mir fehler und verbesserungen posten könnt :)
    danke

    Edit BugFix: Spoiler eingefügt

  • müsste es dann so aussehen?

    [autoit]

    If GuiCtrlRead($APP_CHKBOX[1]) = $GUI_CHECKED Then call ("app_1")

    [/autoit]
  • ok :) dann sollte es so aussehen :)

    [autoit]

    If GuiCtrlRead($APP_CHKBOX[0]) = $GUI_CHECKED Then "app_1"

    [/autoit]


    bzw.

    [autoit]

    If GuiCtrlRead($APP_CHKBOX[0]) = $GUI_CHECKED Then ("app_1")

    [/autoit]

    aber irgendwo muss noch ein hund drin sein hab mir zum testen ja das ganze in kleinformat gemacht das app_1 nur eine batch datei aufruft aber wenn ich dann install klick tut sich gar nix :(

  • danke th.meger, aber die func aufrufen geht bei mir mit call("APP_1) und mit function("APP_1") nicht

    ich habs schnell ausprobiert ob da noch ein fehler in dem code, der die func aufrufe, das klappt :)
    vlt. ist noch im array ein fehler oder sonst im script :(
    Findet ihr zufällig noch einen?

    Einmal editiert, zuletzt von max0664 (30. April 2007 um 13:05)