GUICtrlCreateCombo Verschachtelung

  • Hallo Liebe AutoITler,

    ich habe mal wieder eine Frage:

    Aber zuerst mal den AutoIT Code:

    [autoit]


    #include <GUIConstants.au3>

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

    GUICreate("Rakware USB-Support", 270, 100)
    ;1 Auswahl
    GUICtrlCreateCombo ("Programmgruppe", 10, 10, 250, 0)
    GUICtrlSetData(-1,"Programmgruppe","Programmgruppe")
    ;2. Auswahl
    GUICtrlCreateCombo ("Programme", 10, 40, 250, 0)
    GUICtrlSetData(-1,"Programme","Programme")
    ;Ausführen oder Installieren Button
    GUICtrlCreateButton("Ausführen/Installieren", 180, 70, 80)

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

    GUISetState ()

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

    While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Wend

    [/autoit]

    Hier noch die ini Datei:

    Code
    Security;"Avira Premium Security Suite";"files\security\Avira_Premium_Security_Suite.exe";Installieren
    Security;"Avira Removal Tool";"files\security\Avira_Removal_Tool.exe.exe";Ausführen
    System;"PuTTY";"files\system\putty.exe";Installieren

    Ich würde gern Informationen aus einer ini Datei auslesen, und in einer Verschachtelten GUICtrlCreateCombo ausgeben.
    Also laut INI Datei soll die erste GUICtrlCreateCombo 2 Auswahlmöglichkeiten bieten:
    1. Security
    2. System
    In der 2ten GUICtrlCreateCombo soll sich dann die Auswahl ändern, je nachdem was man in der ersten Auswahlmöglichkeit gewählt hat.
    Wenn ich Security ausgewählt habe, sollte ich Avira Premium Security Suite bzw. Avira Removal Tool auswählen können.
    Beim drücken des Button sollte dann die hinterlegte EXE Datei ausgeführt werden.
    Die Beschriftung des Buttons sollte sich aus der Auswahl der 2 GUICtrlCreateCombo mit dem letzten Zeileneintrag der INI Datei ändern entweder in Ausführen oder Installieren.

    Ist sowas machbar, wenn ja kann mir jemand helfen.

    Vielen Dank im vorraus.

    Gruß
    Ronnie

    Einmal editiert, zuletzt von ZoeLeah (4. März 2009 um 16:55)

  • Phu, gar nicht so wenig arbeit ;)

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <File.au3>
    #include <GUIConstantsEx.au3>

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

    Opt('GUIOnEventMode', 1)

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

    GUICreate("Rakware USB-Support", 270, 100)
    GUISetOnEvent($GUI_EVENT_CLOSE, '_Exit')

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

    ;1 Auswahl
    $hComboGroup = GUICtrlCreateCombo ("Programmgruppe wählen", 10, 10, 250, 0)
    GUICtrlSetOnEvent(-1, '_Auswahl1')
    $hComboProg = GUICtrlCreateCombo ("", 10, 40, 250, 0)
    GUICtrlSetOnEvent(-1, '_Auswahl2')

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

    ;Ausführen oder Installieren Button
    $hButton = GUICtrlCreateButton("Ausführen/Installieren", 180, 70, 80)
    GUICtrlSetOnEvent(-1, '_start')

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

    Local $aAuswahl, $aDummy
    _FileReadToArray('Test.ini', $aAuswahl)
    Global $Options[$aAuswahl[0]][4]

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

    For $i = 1 To $aAuswahl[0]
    $aDummy = StringSplit($aAuswahl[$i], ';', 2)
    For $j = 0 To UBound($aDummy) -1
    $Options[$i-1][$j] = $aDummy[$j]
    Next
    GUICtrlSetData($hComboGroup, $aDummy[0], 'Programmgruppe wählen')
    Next

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

    GUISetState ()

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

    While 1
    Sleep(100000)
    Wend

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

    Func _Exit()
    Exit
    EndFunc

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

    Func _Auswahl1()
    Local $search = GUICtrlRead(@GUI_CtrlId)
    GUICtrlSetData($hComboProg, '')
    For $i = 0 To UBound($Options, 1) -1
    If $search = $Options[$i][0] Then
    GUICtrlSetData($hComboProg, $Options[$i][1], $Options[$i][1])
    GUICtrlSetData($hButton, $Options[$i][3])
    EndIf
    Next
    EndFunc

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

    Func _Auswahl2()
    Local $search = GUICtrlRead(@GUI_CtrlId)
    For $i = 0 To UBound($Options, 1) -1
    If $search = $Options[$i][1] Then GUICtrlSetData($hButton, $Options[$i][3])
    Next
    EndFunc

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

    Func _start()
    Local $search = GUICtrlRead($hComboProg)
    For $i = 0 To UBound($Options, 1) -1
    If $search = $Options[$i][1] Then MsgBox(0,$Options[$i][3], $Options[$i][2])
    Next
    EndFunc

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

    Ich hoffe so passt es ungefähr für dich. Anpassen kannst du es bestimmt selber.

  • Sorry aber ich bin ein Noob und bekomme das nicht zum laufen.
    Wie soll ich die MsgBox ersetzen, das das hinterlegte Programm aufgerufen wird?

    Gruß
    Ronnie