Hallo
Ich hatte vor mir einen kleinen "Entscheidungsbot" zu coden.Man hat 10 Checkboxen und ich will,dass dies(e) Checkbox(en), die nicht checked sind auch nicht als msgbox auftauchen.
Hier der Code:
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiTreeView.au3>
#Region ### START Koda GUI section ### Form=E:\StuffZz\AUTOIT\AUTOIT Lap\GUI\Forms\Entscheidungsbot.kxf
$Form1 = GUICreate("Entscheidungsbot by XMBomb", 339, 486, 192, 124)
$Label1 = GUICtrlCreateLabel("Entscheidungsbot by XMBomb", 0, 0, 334, 33)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("GO!", 0, 40, 337, 193)
GUICtrlSetFont(-1, 120, 400, 0, "MS Sans Serif")
$Checkbox1 = GUICtrlCreateCheckbox("MW2", 8, 240, 145, 17)
$Checkbox2 = GUICtrlCreateCheckbox("BFBC2", 8, 264, 145, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Minecraft", 8, 288, 129, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Code", 8, 312, 129, 17)
$Checkbox5 = GUICtrlCreateCheckbox("Färnseh luege", 8, 336, 113, 17)
$Checkbox6 = GUICtrlCreateCheckbox("EtoA", 8, 360, 113, 17)
$Checkbox7 = GUICtrlCreateCheckbox("Bulletstorm", 8, 384, 129, 17)
$Checkbox8 = GUICtrlCreateCheckbox("Just Cause 2", 8, 408, 169, 17)
$Checkbox9 = GUICtrlCreateCheckbox("Lernen/Husi machen", 8, 432, 297, 17)
$Checkbox10 = GUICtrlCreateCheckbox("Aufräumen", 8, 456, 169, 17)
$Button2 = GUICtrlCreateButton("Check all", 160, 328, 145, 49)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $Button2
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
GUICtrlSetState($Checkbox2, $GUI_CHECKED)
GUICtrlSetState($Checkbox3, $GUI_CHECKED)
GUICtrlSetState($Checkbox4, $GUI_CHECKED)
GUICtrlSetState($Checkbox5, $GUI_CHECKED)
GUICtrlSetState($Checkbox6, $GUI_CHECKED)
GUICtrlSetState($Checkbox7, $GUI_CHECKED)
GUICtrlSetState($Checkbox8, $GUI_CHECKED)
GUICtrlSetState($Checkbox9, $GUI_CHECKED)
GUICtrlSetState($Checkbox10, $GUI_CHECKED)
Case $Button1
$ran = Random (1,10,1)
if GUICtrlRead ($Checkbox1) = $GUI_UNCHECKED then Global $1 = False
if GUICtrlRead ($Checkbox2) = $GUI_UNCHECKED then Global $2 = False
if GUICtrlRead ($Checkbox3) = $GUI_UNCHECKED then Global $3 = False
if GUICtrlRead ($Checkbox4) = $GUI_UNCHECKED then Global $4 = False
if GUICtrlRead ($Checkbox5) = $GUI_UNCHECKED then Global $5 = False
if GUICtrlRead ($Checkbox6) = $GUI_UNCHECKED then Global $6 = False
if GUICtrlRead ($Checkbox7) = $GUI_UNCHECKED then Global $7 = False
if GUICtrlRead ($Checkbox8) = $GUI_UNCHECKED then Global $8 = False
if GUICtrlRead ($Checkbox9) = $GUI_UNCHECKED then Global $9 = False
if GUICtrlRead ($Checkbox10) = $GUI_UNCHECKED then Global $10 = False
if $ran = 1 Then $1 = MsgBox (0, "Resultat:", "Du musst MW2 Zocken")
if $ran = 2 Then $2= MsgBox (0, "Resultat:", "Du musst Battlefield Zocken")
if $ran = 3 Then $3 =MsgBox (0, "Resultat:", "Du musst Minecraft Zocken")
if $ran = 4 Then $4 =MsgBox (0, "Resultat:", "Du musst Coden")
if $ran = 5 Then $5 =MsgBox (0, "Resultat:", "Du musst Fernsehen schauen")
if $ran = 6 Then $6=MsgBox (0, "Resultat:", "Du musst EtoA Zocken")
if $ran = 7 Then $7=MsgBox (0, "Resultat:", "Du musst Bulletstorm Zocken")
if $ran = 8 Then $8=MsgBox (0, "Resultat:", "Du musst Just Cause 2 Zocken")
if $ran = 9 Then $9=MsgBox (0, "Resultat:", "Du musst lernen oder Husi machen")
if $ran = 10 Then $10=MsgBox (0, "Resultat:","Du musst aufräumen")
EndSwitch
WEnd
Habt ihr eine Idee, wie es funktionieren könnte, denn jetzt kommen leider immer nur alle Möglichkeiten und nicht nur die die checked sind...