Checkbox in Kombination mit Input Feld

  • Hallo Liebe Autoit Gemeinde,

    ich hab folgendes Script (siehe Unten)

    Wenn es startet, dann ist das Input Feld nicht da, so soll es ja auch.
    Setze ich die Checkbox auf ON wird das Input Feld aktiv.
    Setz ich es hingegen auf OFF soll das Input Feld auch wieder daktiviert/unsicht bar gemacht werden.
    Aber irgendwie bekomm ich es leider nicht hin, hab da wohl einen kleinen Denkfehler.

    Liebe Grüße & Vielen Dank

    [autoit]


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

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

    #Region ### START Koda GUI section ### Form=
    $FProxy = GUICreate("Proxy", 352, 107, 192, 124)
    $IN_proxy = GUICtrlCreateInput("", 8, 8, 225, 21)
    GUICtrlSetState(-1, $GUI_HIDE)
    $GSettings = GUICtrlCreateGroup("Settings", 8, 40, 169, 57)
    $R_On = GUICtrlCreateRadio("On", 24, 64, 57, 25)
    $R_Off = GUICtrlCreateRadio("Off", 104, 64, 57, 25)
    $Ok = GUICtrlCreateButton("Ok", 272, 8, 65, 33, $WS_GROUP)
    $Close = GUICtrlCreateButton("Close", 272, 56, 65, 33, $WS_GROUP)
    GUISetState(@SW_SHOW)
    Global $msg, $IN_proxy
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $Ok
    If GUICtrlRead($R_On) = $GUI_CHECKED Then
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyEnable","REG_DWORD",1)
    RegWrite ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyServer","REG_SZ",GUICtrlRead($IN_proxy))
    Exit
    ElseIf GUICtrlRead($R_Off) = $GUI_CHECKED Then

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

    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyEnable","REG_DWORD",0)
    ExitLoop
    EndIf
    Case $msg = $R_Off
    If $msg = $R_off And BitAND(GUICtrlRead($R_off), $GUI_CHECKED) = $GUI_CHECKED Then
    GUICtrlCreateInput("", 8, 8, 225, 21)
    GUICtrlSetState(-1, $GUI_HIDE)
    EndIf
    Case $msg = $R_On
    GUICtrlCreateInput("", 8, 8, 225, 21)
    GUICtrlSetState(-1, $GUI_ENABLE)

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

    Case $msg = $Close
    ExitLoop
    Case $msg = $GUI_EVENT_CLOSE
    ExitLoop
    EndSelect
    WEnd

    [/autoit][autoit][/autoit][autoit][/autoit]
  • Spoiler anzeigen
    [autoit]

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

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

    #region ### START Koda GUI section ### Form=
    $FProxy = GUICreate("Proxy", 352, 107, 192, 124)
    $IN_proxy = GUICtrlCreateInput("", 8, 8, 225, 21)
    GUICtrlSetState(-1, $GUI_HIDE)
    $GSettings = GUICtrlCreateGroup("Settings", 8, 40, 169, 57)
    $R_On = GUICtrlCreateRadio("On", 24, 64, 57, 25)
    $R_Off = GUICtrlCreateRadio("Off", 104, 64, 57, 25)
    $Ok = GUICtrlCreateButton("Ok", 272, 8, 65, 33, $WS_GROUP)
    $Close = GUICtrlCreateButton("Close", 272, 56, 65, 33, $WS_GROUP)
    $input = GUICtrlCreateInput("", 8, 8, 225, 21)
    GUICtrlSetState(-1, $GUI_HIDE)
    GUISetState(@SW_SHOW)
    Global $msg, $IN_proxy
    #endregion ### END Koda GUI section ###

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

    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $Ok
    If BitAND(GUICtrlRead($R_On), $GUI_CHECKED) = $GUI_CHECKED Then
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", 1)
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", GUICtrlRead($IN_proxy))
    Exit
    ElseIf BitAND(GUICtrlRead($R_Off), $GUI_CHECKED) = $GUI_CHECKED Then
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", 0)
    ExitLoop
    EndIf
    Case $msg = $R_Off
    If BitAND(GUICtrlRead($R_Off), $GUI_CHECKED) = $GUI_CHECKED Then
    GUICtrlSetState($input, $GUI_HIDE)
    EndIf
    Case $msg = $R_On
    If BitAND(GUICtrlRead($R_On), $GUI_CHECKED) = $GUI_CHECKED Then
    GUICtrlSetState($input, $GUI_SHOW)
    EndIf
    Case $msg = $Close
    ExitLoop
    Case $msg = $GUI_EVENT_CLOSE
    ExitLoop
    EndSelect
    WEnd

    [/autoit]
  • Also ich sehe keine Checkbox nur zwei Radios. Und wenn dann macht man sowas mit nur einer Checkbox oder Radio.
    Noch nen paar Tips; Variablendeklaration am besten am Anfang des Scriptes unter den Includes und statt dem Select Switch nehmen.