alan lim Posted September 11, 2012 Posted September 11, 2012 (edited) Hello, I wanted to have application installation based on the selection as the scenario as shown below, If 111 radio button is selected, then AAA and BBB will be auto checked on the check box. If 222 radio button is selected, then BBB and CCC will be auto checked on the check box. The same sequence as 333 and 444. During the selection, I also have an option to tick on any check box which is not checked. Example, If 111 is select, then AAA and BBB will definitely be auto checked. At this moment, i have option to tick on CCC or DDD or both. Finally, how many application will be installed is based on the Group1 selection. I would appreciate someone could guide me or any sample that I can refer to. Thank you Regards, Alan Lim Edited September 11, 2012 by alan lim
Moderators JLogan3o13 Posted September 11, 2012 Moderators Posted September 11, 2012 Hi, alan lim. How about posting what you have thus far? We're not in the habit of writing code from scratch for you, but will gladly assist you with getting your code to work. Post whatever you have, even if it doesn't work, and we can help you modify it "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!
alan lim Posted September 12, 2012 Author Posted September 12, 2012 Hi jlogan3o13 I am new to autoit, i do not have script on it and also do not know how to start with. Thus i need some sample to refer. Any suggestion? Regards, Alan lim
Moderators JLogan3o13 Posted September 12, 2012 Moderators Posted September 12, 2012 Hi, alan lim. The help file, along with the Wiki, are great places to start. I would begin with creating your GUI (GUICreate in the help file), and placing either the checkboxes (GUICtrlCreateCheckbox) or radio buttons (GUICtrlCreateRadio). Once you have that, you can look into the other aspects that you would like to accomplish. Once you have something, feel free to post here (even if it doesn't work quite like you'd like it to!) and we will be happy to asssist "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!
somdcomputerguy Posted September 12, 2012 Posted September 12, 2012 After the checkboxes and radio buttons are created, the GUICtrlSetState() function can be used to toggle their states. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
alan lim Posted September 17, 2012 Author Posted September 17, 2012 Hi jlogan3o13, I managed to create a simple script which i have mentioned my intention for this script. Currently, it only works if i click on radio button on the left and it will auto checked on the check box on the right. But I could not get the result of the checked box on the left if i click on "install" button. I hope you can help me. Big thank you. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #region ### START Koda GUI section ### Form=C:Usersalan ly limDesktopForm1_1_1.kxf $Form1_1_1 = GUICreate("Form1", 616, 439, 192, 124) $R_ASR = GUICtrlCreateRadio("Radio1", 30, 88, 13, 17) $R_ADV = GUICtrlCreateRadio("Radio2", 30, 136, 13, 17) $R_IAS7 = GUICtrlCreateRadio("Radio3", 30, 176, 13, 17) $R_TAX = GUICtrlCreateRadio("Radio4", 30, 224, 13, 17) $Label1 = GUICtrlCreateLabel("DEPT", 40, 40, 120, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("111", 88, 88, 80, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Label3 = GUICtrlCreateLabel("222", 88, 136, 63, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Label4 = GUICtrlCreateLabel("333", 88, 176, 40, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Label5 = GUICtrlCreateLabel("444", 88, 224, 35, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Group1 = GUICtrlCreateGroup("Applications", 328, 32, 249, 377) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Checkbox1 = GUICtrlCreateCheckbox("AAA", 360, 60, 13, 17) $Checkbox2 = GUICtrlCreateCheckbox("BBB", 360, 90, 13, 17) $Checkbox3 = GUICtrlCreateCheckbox("CCC", 360, 120, 13, 17) $Checkbox4 = GUICtrlCreateCheckbox("DDD", 360, 150, 13, 17) $Checkbox5 = GUICtrlCreateCheckbox("EEE", 360, 180, 13, 17) $Checkbox6 = GUICtrlCreateCheckbox("FFF", 360, 210, 13, 17) $Checkbox7 = GUICtrlCreateCheckbox("GGG", 360, 240, 13, 17) $Checkbox8 = GUICtrlCreateCheckbox("HHH", 360, 270, 13, 17) $Checkbox9 = GUICtrlCreateCheckbox("III", 360, 300, 13, 17) $Checkbox10 = GUICtrlCreateCheckbox("JJJ", 360, 330, 13, 17) $Checkbox11 = GUICtrlCreateCheckbox("KKK", 360, 360, 13, 17) $Label6 = GUICtrlCreateLabel("AAA", 384, 60, 32, 20) $Label7 = GUICtrlCreateLabel("BBB", 384, 90, 30, 20) $Label8 = GUICtrlCreateLabel("CCC", 384, 120, 66, 20) $Label9 = GUICtrlCreateLabel("DDD", 384, 150, 55, 20) $Label10 = GUICtrlCreateLabel("EEE", 384, 180, 142, 20) $Label11 = GUICtrlCreateLabel("FFF", 384, 210, 43, 20) $Label12 = GUICtrlCreateLabel("GGG", 384, 240, 43, 20) $Label13 = GUICtrlCreateLabel("HHH", 384, 270, 59, 20) $Label14 = GUICtrlCreateLabel("III", 384, 300, 40, 20) $Label15 = GUICtrlCreateLabel("JJJ", 384, 330, 50, 20) $Label16 = GUICtrlCreateLabel("KKK", 384, 360, 120, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) $InstallButton = GUICtrlCreateButton("Install", 16, 312, 75, 25) $Button2 = GUICtrlCreateButton("Cancel", 144, 312, 75, 25) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $Button2 _Cancel() Case $R_ASR If GUICtrlRead($R_ASR, $GUI_Checked) Then _UNChecked_ALL() GUICtrlSetState($Checkbox1, $GUI_Checked) ; Aura GUICtrlSetState($Checkbox4, $GUI_Checked) ; MyClient GUICtrlSetState($Checkbox7, $GUI_Checked) ; Retain EndIf Case $R_ADV If GUICtrlRead($R_ADV, $GUI_Checked) Then _UNChecked_ALL() GUICtrlSetState($Checkbox7, $GUI_Checked) ; Retain GUICtrlSetState($Checkbox8, $GUI_Checked) ; Smart 3.0 EndIf Case $R_IAS7 If GUICtrlRead($R_IAS7, $GUI_Checked) Then _UNChecked_ALL() GUICtrlSetState($Checkbox3, $GUI_Checked) ; Dynadock GUICtrlSetState($Checkbox5, $GUI_Checked) ; Nuance PDC Converter GUICtrlSetState($Checkbox6, $GUI_Checked) ; Pertax EndIf Case $R_TAX If GUICtrlRead($R_Tax, $GUI_Checked) Then _UNChecked_ALL() GUICtrlSetState($Checkbox2, $GUI_Checked) ; Ctax GUICtrlSetState($Checkbox9, $GUI_Checked) ; Team GUICtrlSetState($Checkbox10, $GUI_Checked) ; TLSinfo EndIf EndSwitch WEnd Func _Install($Program) If $Program = 0 Then MsgBox(4096, "Install", "App1") ElseIf $Program = 1 Then MsgBox(4096, "Install", "App2") ElseIf $Program = 2 Then MsgBox(4096, "Install", "App3") ElseIf $Program = 3 Then MsgBox(4096, "Install", "App4") ElseIf $Program = 4 Then MsgBox(4096, "Install", "App5") ElseIf $Program = 5 Then MsgBox(4096, "Install", "App6") ElseIf $Program = 6 Then MsgBox(4096, "Install", "App7") EndIf EndFunc Func _UNChecked_ALL() ;~ MsgBox(0,"","unchecked") GUICtrlSetState($Checkbox1, $GUI_UnChecked) GUICtrlSetState($Checkbox2, $GUI_UnChecked) GUICtrlSetState($Checkbox3, $GUI_UnChecked) GUICtrlSetState($Checkbox4, $GUI_UnChecked) GUICtrlSetState($Checkbox5, $GUI_UnChecked) GUICtrlSetState($Checkbox6, $GUI_UnChecked) GUICtrlSetState($Checkbox7, $GUI_UnChecked) GUICtrlSetState($Checkbox8, $GUI_UnChecked) GUICtrlSetState($Checkbox9, $GUI_UnChecked) GUICtrlSetState($Checkbox10, $GUI_UnChecked) GUICtrlSetState($Checkbox11, $GUI_UnChecked) EndFunc ;==>UNChecked_ALL Func _Cancel() Local $Cancel $Cancel = MsgBox(262452,"Cancel","Are you sure you want to Cancel?") If $Cancel = 6 Then Exit Endif EndFunc
alan lim Posted September 18, 2012 Author Posted September 18, 2012 Hi All, I am managed to get the "install" button works. Thank you for all the advice.
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