Case Groß und Kleinschreibung

  • Hallo,

    ich möchte, dass wenn in die Inputbox "a" geschrieben wird, dass dann eine Messagebox erscheint, dass "a" ausgewählt wurde. Wenn "A", dann alles eine Messagebox, dass Groß A ausgewählt wurde.

    Hier mal mein Versuch :

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    $Form1 = GUICreate("Form1", 282, 60, 192, 124)
    $Input1 = GUICtrlCreateInput("Input1", 8, 8, 257, 21)
    $Start = GUICtrlCreateButton("Start", 96, 32, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Start
    Switch GUICtrlRead($Input1)
    if $A == "A" then
    MsgBox (64, "Test", "Sie haben A ausgewählt")
    EndIf
    case "a"
    MsgBox (64, "Test", "Sie haben a ausgewählt")
    case "B"
    MsgBox (64, "Test", "Sie haben B ausgewählt")
    Endswitch
    EndSwitch
    WEnd

    [/autoit]

    Funktioniert leider nicht ganz. Kann mir dort bitte jemand helfen?

  • So?

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    $Form1 = GUICreate("Form1", 282, 60, 192, 124)
    $Input1 = GUICtrlCreateInput("Input1", 8, 8, 257, 21)
    $Start = GUICtrlCreateButton("Start", 96, 32, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Start
    If GUICtrlRead($Input1)=="A" Then
    MsgBox (64, "Test", "Sie haben A ausgewählt")
    ElseIf GUICtrlRead($Input1)=="a" Then
    MsgBox (64, "Test", "Sie haben a ausgewählt")
    ElseIf GUICtrlRead($Input1)=="B" Then
    MsgBox (64, "Test", "Sie haben B ausgewählt")
    EndIf

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

    Endswitch
    WEnd

    [/autoit]


    Oder so: ;)

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    $Form1 = GUICreate("Form1", 282, 60, 192, 124)
    $Input1 = GUICtrlCreateInput("Input1", 8, 8, 257, 21)
    $Start = GUICtrlCreateButton("Start", 96, 32, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Start
    $iPos=StringInStr("AaB",GUICtrlRead($Input1),1)
    Switch $iPos
    Case 1
    MsgBox (64, "Test", "Sie haben A ausgewählt")
    Case 2
    MsgBox (64, "Test", "Sie haben a ausgewählt")
    Case 3
    MsgBox (64, "Test", "Sie haben B ausgewählt")
    Case Else
    MsgBox (64, "Test", "Sie haben etwas anderes ausgewählt")
    EndSwitch

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

    Endswitch
    WEnd

    [/autoit]