#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 18, 24, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 123, 51, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 24, 87, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 231, 60, 97, 17)
$Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 258, 111, 97, 17)
$Checkbox6 = GUICtrlCreateCheckbox("Checkbox6", 195, 171, 97, 17)
$Checkbox7 = GUICtrlCreateCheckbox("Checkbox7", 72, 162, 97, 17)
$Checkbox8 = GUICtrlCreateCheckbox("Checkbox8", 120, 243, 97, 17)
$Checkbox9 = GUICtrlCreateCheckbox("Checkbox9", 276, 234, 97, 17)
$Checkbox10 = GUICtrlCreateCheckbox("Checkbox10", 342, 309, 97, 17)
$Button1 = GUICtrlCreateButton("Button1", 447, 129, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Local $var, $count=0, $MaxCount = 10
For $i = $Checkbox1 To $Checkbox10 Step 1
$var = GUICtrlRead($i)
If $var = 1 Then
For $i = $Checkbox1 To $Checkbox10 Step 1
GUICtrlSetState($i, $GUI_UNCHECKED)
Next
ElseIf GUICtrlRead($var) = 4 Then
$count = $count + 1
If $Count = $MaxCount Then
For $i = $Checkbox1 To $Checkbox10 Step 1
GUICtrlSetState($i, $GUI_CHECKED)
Next
EndIf
EndIf
Next
EndSwitch
WEnd