Wert aus Radio Button Group in Variable übergeben??

  • hi zusammen.

    ich habe in autoIt eine gruppe von radio buttons erstellt.
    jetzt möchte ich gerne, dass, je nachdem, welcher button aktiv ist, ein bestimmer string in eine variable geschrieben wird.

    bsp.:
    button 1 aktiv: $string = "abc"
    button2 aktiv:$string = "def"
    button 3 aktiv: $string = "123"
    ....
    usw.

    wie mache ich das am besten. bin noch bisschen n noob :)

    merci,

    beatmax

    • Offizieller Beitrag

    :D - doch, genauso funzt das.

    Hier der Beweis:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

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

    Opt("GUIOnEventMode", 1)
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 542, 309, 193, 115)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
    $Group1 = GUICtrlCreateGroup("Group1", 76, 48, 373, 193)
    $Radio1 = GUICtrlCreateRadio("Radio1", 106, 78, 113, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $Radio2 = GUICtrlCreateRadio("Radio2", 106, 102, 113, 17)
    $Radio3 = GUICtrlCreateRadio("Radio3", 106, 125, 113, 17)
    $Radio4 = GUICtrlCreateRadio("Radio4", 106, 148, 113, 17)
    $Radio5 = GUICtrlCreateRadio("Radio5", 106, 172, 113, 17)
    $Radio6 = GUICtrlCreateRadio("Radio6", 106, 196, 113, 17)
    $Input1 = GUICtrlCreateInput("", 279, 79, 121, 21)
    $MyButton1 = GUICtrlCreateButton("MyButton1", 300, 180, 100, 30, $BS_FLAT)
    GUICtrlSetOnEvent(-1, "MyButton1Click")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    Sleep(100)
    WEnd

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

    Func Form1Close()
    Exit
    EndFunc
    Func MyButton1Click()
    For $i = $Radio1 To $Radio6
    If GUICtrlRead($i) = $GUI_CHECKED Then
    Switch $i
    Case $Radio1
    GUICtrlSetData($Input1, 'Radio1')
    Case $Radio2
    GUICtrlSetData($Input1, 'Radio2')
    Case $Radio3
    GUICtrlSetData($Input1, 'Radio3')
    Case $Radio4
    GUICtrlSetData($Input1, 'Radio4')
    Case $Radio5
    GUICtrlSetData($Input1, 'Radio5')
    Case $Radio6
    GUICtrlSetData($Input1, 'Radio6')
    EndSwitch
    ExitLoop
    EndIf
    Next
    EndFunc

    [/autoit]