Warning 0 Posted January 20, 2011 Hi I'm trying to make a Windows-Cleaner Script with GUI. Current Source:expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=form1.kxf $Form1_1 = GUICreate("Win-Cleaner", 241, 321, 438, 193, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_DLGFRAME,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS)) $Label1 = GUICtrlCreateLabel("Válaszd ki hogy milyen programok", 0, 8, 195, 17) GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("vannak telepítve a számítógépedre.", 0, 24, 208, 17) GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif") $Checkbox1 = GUICtrlCreateCheckbox("Avant Browser", 8, 144, 217, 17) $Checkbox2 = GUICtrlCreateCheckbox("Google Chrome", 8, 120, 137, 17) $Checkbox3 = GUICtrlCreateCheckbox("Mozilla Firefox", 8, 72, 137, 17) $Checkbox4 = GUICtrlCreateCheckbox("Internet Explorer", 8, 48, 169, 17) GUICtrlSetState(-1, $GUI_CHECKED) $Checkbox5 = GUICtrlCreateCheckbox("Opera Browser", 8, 96, 113, 17) $Checkbox6 = GUICtrlCreateCheckbox("MSN Messenger", 8, 168, 113, 17) $Checkbox7 = GUICtrlCreateCheckbox("Spybot Search and Destroy", 8, 216, 153, 17) $Checkbox8 = GUICtrlCreateCheckbox("Punkbuster", 8, 192, 161, 17) $Checkbox9 = GUICtrlCreateCheckbox("Macromedia Flash Player", 8, 240, 145, 17) $Button1 = GUICtrlCreateButton("Kiválaszt", 64, 280, 105, 25, 0) $Button2 = GUICtrlCreateButton("X", 216, 0, 17, 17, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit 0 Case $Button2 exit 0 Case $Button1 Do sg. If Checkbox1 activated Do an other thing If Checkbox2 activated ..... EndSwitch WEndWhile 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit 0 Case $Button2 exit 0 Case $Button1 Do sg. If Checkbox1 activated Do an other thing If Checkbox2 activated ..... EndSwitchWEndIs there any way to let me to that? Because there isn't valuable "return value" of it. (It returns always 5 for me) Share this post Link to post Share on other sites
JLogan3o13 1,639 Posted January 20, 2011 I've never used it myself, but I would think you could use GUICtrlRead to identify the action. Borrowing a little from the helpfile, the snippet below works well... #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $menu1, $n1, $n2, $msg, $menustate, $menutext GUICreate("My GUICtrlRead") $menu1 = GUICtrlCreateMenu("File") $n1 = GUICtrlCreateList("", 10, 10, -1, 100) GUICtrlSetData(-1, "item1|item2|item3", "item2") $n2 = GUICtrlCreateCheckbox("Read", 10, 110, 50) GUICtrlSetState(-1, $GUI_FOCUS) ; the focus is on your checkbox GUISetState() Do $msg = GUIGetMsg() If $msg = $n2 Then ; if box is checked... MsgBox(0, "Selected listbox entry", GUICtrlRead($n1)) ; display the selected listbox entry $menustate = GUICtrlRead($menu1) ; return the state of the menu item $menutext = GUICtrlRead($menu1, 1) ; return the text of the menu item MsgBox(0, "State and text of the menuitem", "state:" & $menustate & @LF & "text:" & $menutext) EndIf Until $msg = $GUI_EVENT_CLOSE EndFunc ; "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Share this post Link to post Share on other sites
Warning 0 Posted January 20, 2011 I've never used it myself, but I would think you could use GUICtrlRead to identify the action. Borrowing a little from the helpfile, the snippet below works well... #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $menu1, $n1, $n2, $msg, $menustate, $menutext GUICreate("My GUICtrlRead") $menu1 = GUICtrlCreateMenu("File") $n1 = GUICtrlCreateList("", 10, 10, -1, 100) GUICtrlSetData(-1, "item1|item2|item3", "item2") $n2 = GUICtrlCreateCheckbox("Read", 10, 110, 50) GUICtrlSetState(-1, $GUI_FOCUS) ; the focus is on your checkbox GUISetState() Do $msg = GUIGetMsg() If $msg = $n2 Then ; if box is checked... MsgBox(0, "Selected listbox entry", GUICtrlRead($n1)) ; display the selected listbox entry $menustate = GUICtrlRead($menu1) ; return the state of the menu item $menutext = GUICtrlRead($menu1, 1) ; return the text of the menu item MsgBox(0, "State and text of the menuitem", "state:" & $menustate & @LF & "text:" & $menutext) EndIf Until $msg = $GUI_EVENT_CLOSE EndFunc ; Ohh, CtrlRead... I check it. Thanks all. I love this Help file Share this post Link to post Share on other sites