Wingens Posted May 27, 2015 Posted May 27, 2015 Hoe can i easely create a function that checks if a checkbox is checked then disable the other checkboxes and visa versa if checked checkbox gets unchecked enable the other checkboxes. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> WinSetState("[CLASS:ConsoleWindowClass]", "", @SW_HIDE) GUICreate("Capture", 344, 210,-1, -1, $WS_POPUPWINDOW) GUICtrlCreateLabel("Bron schijfletter:", 32, 8) $DRIVELETTER = GUICtrlCreateInput("", 24, 32, 97, 21) GUICtrlSetState($DRIVELETTER, $GUI_DISABLE) $SELECTDRIVE = GUICtrlCreateButton("...", 128, 32, 27, 17) GUICtrlCreateLabel("Gevonden OS:", 216, 8) $FOUNDOS = GUICtrlCreateInput("", 184, 32, 137, 21) GUICtrlSetState($FOUNDOS, $GUI_DISABLE) GUICtrlCreateGroup("Geïnstalleerd OS", 24, 64, 297, 97) $WIN7EMB = GUICtrlCreateCheckbox("Windows 7 - Embedded", 32, 88, 137, 17) $WIN7X86 = GUICtrlCreateCheckbox("Windows 7 - 32Bit", 32, 112, 137, 17) $WIN7AMD64 = GUICtrlCreateCheckbox("Windows 7 - 64Bit", 32, 136, 113, 17) $WIN81EMB = GUICtrlCreateCheckbox("Windows 8.1 - Embedded", 176, 88, 137, 17) $WIN81AMD64 = GUICtrlCreateCheckbox("Windows 8.1 - 64Bit", 176, 112, 137, 17) $WIN10 = GUICtrlCreateCheckbox("Windows 10 - 64Bit", 176, 136, 137, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $START = GUICtrlCreateButton("Start", 134, 176, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Select Case $Msg = $SELECTDRIVE SelectSource() Case $Msg = $START ERRORCATCH() Case $Msg = $GUI_EVENT_CLOSE $YesOrNo = msgBox(4,"","Weet je zeker dat je wilt stoppen?") If $YesOrNo = 6 then WinSetState("[CLASS:ConsoleWindowClass]", "", @SW_SHOW) Exit EndIf EndSelect WEnd Func SelectSource() $SourceData = FileSelectFolder("Kies schijfletter...", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}") GUICtrlSetData($DRIVELETTER, $SourceData) If FileExists($SourceData & "Program Files\Outlook Express") Then GUICtrlSetData($FOUNDOS, "Windows XP") EndIf If FileExists($SourceData & "Program Files\Windows Mail") Then GUICtrlSetData($FOUNDOS, "Vista or above") EndIf $EMPTY = GUICtrlRead($FOUNDOS) If $EMPTY = "" Then GUICtrlSetData($FOUNDOS, "Unknown") EndIf EndFunc Func ERRORCATCH() $GO = 1 If GUICtrlRead($DRIVELETTER) = "" Then $GO = 0 EndIf If $GO = 1 Then Start() EndIf EndFunc Func Start() GUICtrlSetState($SELECTDRIVE, $GUI_DISABLE) GUICtrlSetState($WIN7EMB, $GUI_DISABLE) GUICtrlSetState($WIN7X86, $GUI_DISABLE) GUICtrlSetState($WIN7AMD64, $GUI_DISABLE) GUICtrlSetState($WIN81EMB, $GUI_DISABLE) GUICtrlSetState($WIN81AMD64, $GUI_DISABLE) GUICtrlSetState($WIN10, $GUI_DISABLE) GUICtrlSetState($START, $GUI_DISABLE) If GUICtrlRead($WIN7EMB) = $GUI_CHECKED Then $VAR1 = "CAPTURE-WIN7-EMBEDDED.WIM" If GUICtrlRead($WIN7EMB) = $GUI_CHECKED Then $VAR2 = "EMBEDDED" If GUICtrlRead($WIN7X86) = $GUI_CHECKED Then $VAR1 = "CAPTURE-WIN7-X86.WIM" If GUICtrlRead($WIN7X86) = $GUI_CHECKED Then $VAR2 = "X86" If GUICtrlRead($WIN7AMD64) = $GUI_CHECKED Then $VAR1 = "CAPTURE-WIN7-X64.WIM" If GUICtrlRead($WIN7AMD64) = $GUI_CHECKED Then $VAR2 = "AMD64" If GUICtrlRead($WIN81EMB) = $GUI_CHECKED Then $VAR1 = "CAPTURE-WIN81-EMBEDDED.WIM" If GUICtrlRead($WIN81EMB) = $GUI_CHECKED Then $VAR2 = "EMBEDDED" If GUICtrlRead($WIN81AMD64) = $GUI_CHECKED Then $VAR1 = "CAPTURE-WIN81-X64.WIM" If GUICtrlRead($WIN81AMD64) = $GUI_CHECKED Then $VAR2 = "AMD64" If GUICtrlRead($WIN10) = $GUI_CHECKED Then $VAR1 = "CAPTURE-WIN10-X64.WIM" If GUICtrlRead($WIN10) = $GUI_CHECKED Then $VAR2 = "CAPTURE-WIN10-X64.WIM" $VAR3 = GUICtrlRead($DRIVELETTER) $FILE = "P:\Script\Capture\capture.cmd" FileCopy($FILE, "X:\", 1) $FILE = "X:\capture.cmd" _ReplaceStringInFile($FILE, "VAR1", $VAR1) _ReplaceStringInFile($FILE, "VAR2", $VAR2) _ReplaceStringInFile($FILE, "VAR3", $VAR3) RunWait("X:\capture.cmd") EndFunc
Moderators Melba23 Posted May 27, 2015 Moderators Posted May 27, 2015 Wingens,I think you want Radiobuttons rather than Checkboxes - then you can only ever select one at a time and it is all done automatically:GUICtrlCreateGroup("Geïnstalleerd OS", 24, 64, 297, 97) $WIN7EMB = GUICtrlCreateRadio("Windows 7 - Embedded", 32, 88, 137, 17) $WIN7X86 = GUICtrlCreateRadio("Windows 7 - 32Bit", 32, 112, 137, 17) $WIN7AMD64 = GUICtrlCreateRadio("Windows 7 - 64Bit", 32, 136, 113, 17) $WIN81EMB = GUICtrlCreateRadio("Windows 8.1 - Embedded", 176, 88, 137, 17) $WIN81AMD64 = GUICtrlCreateRadio("Windows 8.1 - 64Bit", 176, 112, 137, 17) $WIN10 = GUICtrlCreateRadio("Windows 10 - 64Bit", 176, 136, 137, 17) GUICtrlCreateGroup("", -99, -99, 1, 1)M23 Wingens 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Wingens Posted May 27, 2015 Author Posted May 27, 2015 Melba23 as usual thank you, it was this simple why didn't i think of this.Maybe you can help me with another problem as you can see in the script i am trying the read the Windows version that is chosen in the driveletter.Is there a way it can be done more accuratly?
Moderators Melba23 Posted May 27, 2015 Moderators Posted May 27, 2015 Wingens,Glad you found the answer useful - we are all guilty of overcomplicating things from time to time.But I am afraid I have no idea about the other problem - although I do see you have a thread running on that question so I will reply there if anything comes to mind.M23 Alenis 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now