; *** Start added by AutoIt3Wrapper *** #include ; *** End added by AutoIt3Wrapper *** #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include #include Opt("GUIOnEventMode", 1) Opt('MustDeclareVars', 1) Global $aBtnIds[9][2] $aBtnIds[0][1] = "func1" $aBtnIds[1][1] = "func2" $aBtnIds[2][1] = "func3" $aBtnIds[3][1] = "func4" $aBtnIds[4][1] = "func5" $aBtnIds[5][1] = "func6" $aBtnIds[6][1] = "func7" $aBtnIds[7][1] = "func8" $aBtnIds[8][1] = "func9" Global $iSeg Global $hGui = GUICreate('CheckBoxtest', 105, 175) Global $msg For $i = 0 To 8 $aBtnIds[$i][0] = GUICtrlCreateCheckBox($i + 1, 10 + Mod($i, 3) * 30, 10 + Int($i / 3) * 30, 25, 25) GUICtrlSetOnEvent(-1, '_Click') ConsoleWrite($i + 1 & ': ' & $aBtnIds[$i][0] & @CRLF) Next Global $idBtnSubmit = GUICtrlCreateButton('OK', 10, 110, 90, 25) ConsoleWrite('OK: ' & $idBtnSubmit & @CRLF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetOnEvent(-1, '_Submit') Global $idProgress=GUICtrlCreateProgress(10,140,85,25) GUISetOnEvent($GUI_EVENT_CLOSE,'_Exit') GUISetState() While 1 Sleep(10000) WEnd Func _Click() ;Local $iBtn = @GUI_CtrlId - $aBtnIds[0][0] ;ConsoleWrite($iBtn+1&' = '&'CtrlID: '&@GUI_CtrlId&@CRLF) Local $bAtLeastOneCheckBoxChecked For $i = 0 To 8 If BitAND(GUICtrlRead($aBtnIds[$i][0]),$GUI_checked)=$GUI_checked Then $bAtLeastOneCheckBoxChecked = True ExitLoop EndIf Next If $bAtLeastOneCheckBoxChecked Then GUICtrlSetState($idBtnSubmit, $GUI_ENABLE) Else GUICtrlSetState($idBtnSubmit, $GUI_DISABLE) EndIf EndFunc ;==>_Click Func _Submit() Local $sFunc='', $iCount GUICtrlSetData($idProgress,0) For $i = 0 To 8 If BitAND(GUICtrlRead($aBtnIds[$i][0]),$GUI_checked)=$GUI_checked Then $iCount+=1 Next $iSeg=Int(100/$iCount) For $i = 0 To 8 If BitAND(GUICtrlRead($aBtnIds[$i][0]),$GUI_checked)=$GUI_checked Then Call($aBtnIds[$i][1]) $sFunc&=$aBtnIds[$i][1]&'|' EndIf Next GUICtrlSetData($idProgress,100) $sFunc=StringTrimRight($sFunc,1) ConsoleWrite('Funcs are called: '&$sFunc&@CRLF&@CRLF) EndFunc ;==>_Submit Func _exit() Exit EndFunc Func Func1() Sleep(Random(100,1000,1)) GUICtrlSetData($idProgress,GUICtrlRead($idProgress)+$iSeg) EndFunc Func Func2() Sleep(Random(100,1000,1)) GUICtrlSetData($idProgress,GUICtrlRead($idProgress)+$iSeg) EndFunc Func Func3() Sleep(Random(100,1000,1)) GUICtrlSetData($idProgress,GUICtrlRead($idProgress)+$iSeg) EndFunc Func Func4() Sleep(Random(100,1000,1)) GUICtrlSetData($idProgress,GUICtrlRead($idProgress)+$iSeg) EndFunc Func Func5() Sleep(Random(100,1000,1)) GUICtrlSetData($idProgress,GUICtrlRead($idProgress)+$iSeg) EndFunc Func Func6() Sleep(Random(100,1000,1)) GUICtrlSetData($idProgress,GUICtrlRead($idProgress)+$iSeg) EndFunc Func Func7() Sleep(Random(100,1000,1)) GUICtrlSetData($idProgress,GUICtrlRead($idProgress)+$iSeg) EndFunc Func Func8() Sleep(Random(100,1000,1)) GUICtrlSetData($idProgress,GUICtrlRead($idProgress)+$iSeg) EndFunc Func Func9() Sleep(Random(100,1000,1)) GUICtrlSetData($idProgress,GUICtrlRead($idProgress)+$iSeg) EndFunc