Kilgore Posted January 23, 2007 Share Posted January 23, 2007 Hi all ! I have created form with Koda, that's is OK, now i try to install many apps when checkbox is checked or not, but i don't find answer to my question. You can help me ? The code : #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=C:\Documents and Settings\Raphaël\Bureau\Programme install XP\Install.kxf $Form1 = GUICreate("Programmes additionnels", 373, 243, -1, -1) $Btn_Framework = GUICtrlCreateCheckbox("Microsoft Framework.NET 3", 24, 72, 153, 17) $Txt_Des = GUICtrlCreateLabel("Séléction des composants additionnels à installer :", 24, 16, 240, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Fond = GUICtrlCreateGraphic(-8, 0, 380, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $Btn_Reader8 = GUICtrlCreateCheckbox("Adobe Acrobat Reader 8", 24, 136, 137, 17) $Btn_7zip = GUICtrlCreateCheckbox("7-Zip 4", 24, 168, 57, 17) $Btn_UtraVNC = GUICtrlCreateCheckbox("Ultr@VNC Server", 24, 104, 193, 17) $Cadre = GUICtrlCreateGroup("", 8, 56, 357, 145) GUICtrlCreateGroup("", -99, -99, 1, 1) $Btn_OK = GUICtrlCreateButton("&OK", 284, 210, 81, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $msg = GUIGetMsg() Select Case $msg = $Btn_OK ExitLoop EndSelect WEnd Can you give me indices or references to create this small script ? Thanks Link to comment Share on other sites More sharing options...
Will66 Posted January 23, 2007 Share Posted January 23, 2007 GUICtrlRead is one way. Quick example: #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=C:\Documents and Settings\Raphaël\Bureau\Programme install XP\Install.kxf $Form1 = GUICreate("Programmes additionnels", 373, 243, -1, -1) $Btn_Framework = GUICtrlCreateCheckbox("Microsoft Framework.NET 3", 24, 72, 153, 17) $Txt_Des = GUICtrlCreateLabel("Séléction des composants additionnels à installer :", 24, 16, 240, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Fond = GUICtrlCreateGraphic(-8, 0, 380, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $Btn_Reader8 = GUICtrlCreateCheckbox("Adobe Acrobat Reader 8", 24, 136, 137, 17) $Btn_7zip = GUICtrlCreateCheckbox("7-Zip 4", 24, 168, 57, 17) $Btn_UtraVNC = GUICtrlCreateCheckbox("Ultr@VNC Server", 24, 104, 193, 17) $Cadre = GUICtrlCreateGroup("", 8, 56, 357, 145) GUICtrlCreateGroup("", -99, -99, 1, 1) $Btn_OK = GUICtrlCreateButton("&OK", 284, 210, 81, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Do $msg = GUIGetMsg() Select Case $msg = $Btn_OK $thisCheckbox="Un - Checked" $checkbox_state = GUICtrlRead($Btn_Framework); return the state of the Microsoft Framework.NET 3 checkbox If $checkbox_state = 1 then $thisCheckbox="Checked" MsgBox(0,"Microsoft Framework.NET 3",$thisCheckbox) EndSelect Until $msg = $GUI_EVENT_CLOSE Link to comment Share on other sites More sharing options...
sandyd Posted January 23, 2007 Share Posted January 23, 2007 (edited) See the following code. It allows you to test if a checkbox control is CHECKED or not. expandcollapse popup#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=C:\Documents and Settings\Raphaël\Bureau\Programme install XP\Install.kxf $Form1 = GUICreate("Programmes additionnels", 373, 243, -1, -1) $Btn_Framework = GUICtrlCreateCheckbox("Microsoft Framework.NET 3", 24, 72, 153, 17) $Txt_Des = GUICtrlCreateLabel("Séléction des composants additionnels à installer :", 24, 16, 240, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Fond = GUICtrlCreateGraphic(-8, 0, 380, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $Btn_Reader8 = GUICtrlCreateCheckbox("Adobe Acrobat Reader 8", 24, 136, 137, 17) $Btn_7zip = GUICtrlCreateCheckbox("7-Zip 4", 24, 168, 57, 17) $Btn_UtraVNC = GUICtrlCreateCheckbox("Ultr@VNC Server", 24, 104, 193, 17) $Cadre = GUICtrlCreateGroup("", 8, 56, 357, 145) GUICtrlCreateGroup("", -99, -99, 1, 1) $Btn_OK = GUICtrlCreateButton("&OK", 284, 210, 81, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $msg = GUIGetMsg() Select Case $msg = $Btn_OK If GUICtrlRead($Btn_Framework) = $GUI_CHECKED Then MsgBox(0,'Microsoft Framework.NET 3 checked','Place some code here to execute the setup program for Microsoft Framework.NET 3') EndIf If GUICtrlRead($Btn_Reader8) = $GUI_CHECKED Then MsgBox(0,'Adobe Acrobat Reader 8 checked','Place some code here to execute the setup program for Adobe Acrobat Reader 8') EndIf If GUICtrlRead($Btn_7zip) = $GUI_CHECKED Then MsgBox(0,'7-Zip 4 checked','Place some code here to execute the setup program for 7-Zip 4') EndIf If GUICtrlRead($Btn_UtraVNC) = $GUI_CHECKED Then MsgBox(0,'Ultr@VNC Server checked','Place some code here to execute the setup program for Ultr@VNC Server') EndIf ExitLoop EndSelect WEnd I would use the RunWait command to ensure that each install waits on the previous one before commencing. (Put the RunWait commands where I have put MsgBoxs) Note that some installations require a reboot once installed so you may only get so many apps installed before having to re-run the script. Edited January 23, 2007 by sandyd ----[ SandyD ]--- Link to comment Share on other sites More sharing options...
Kilgore Posted January 23, 2007 Author Share Posted January 23, 2007 See the following code.It allows you to test if a checkbox control is CHECKED or not.expandcollapse popup#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=C:\Documents and Settings\Raphaël\Bureau\Programme install XP\Install.kxf $Form1 = GUICreate("Programmes additionnels", 373, 243, -1, -1) $Btn_Framework = GUICtrlCreateCheckbox("Microsoft Framework.NET 3", 24, 72, 153, 17) $Txt_Des = GUICtrlCreateLabel("Séléction des composants additionnels à installer :", 24, 16, 240, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Fond = GUICtrlCreateGraphic(-8, 0, 380, 49) GUICtrlSetBkColor(-1, 0xFFFFFF) $Btn_Reader8 = GUICtrlCreateCheckbox("Adobe Acrobat Reader 8", 24, 136, 137, 17) $Btn_7zip = GUICtrlCreateCheckbox("7-Zip 4", 24, 168, 57, 17) $Btn_UtraVNC = GUICtrlCreateCheckbox("Ultr@VNC Server", 24, 104, 193, 17) $Cadre = GUICtrlCreateGroup("", 8, 56, 357, 145) GUICtrlCreateGroup("", -99, -99, 1, 1) $Btn_OK = GUICtrlCreateButton("&OK", 284, 210, 81, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $msg = GUIGetMsg() Select Case $msg = $Btn_OK If GUICtrlRead($Btn_Framework) = $GUI_CHECKED Then MsgBox(0,'Microsoft Framework.NET 3 checked','Place some code here to execute the setup program for Microsoft Framework.NET 3') EndIf If GUICtrlRead($Btn_Reader8) = $GUI_CHECKED Then MsgBox(0,'Adobe Acrobat Reader 8 checked','Place some code here to execute the setup program for Adobe Acrobat Reader 8') EndIf If GUICtrlRead($Btn_7zip) = $GUI_CHECKED Then MsgBox(0,'7-Zip 4 checked','Place some code here to execute the setup program for 7-Zip 4') EndIf If GUICtrlRead($Btn_UtraVNC) = $GUI_CHECKED Then MsgBox(0,'Ultr@VNC Server checked','Place some code here to execute the setup program for Ultr@VNC Server') EndIf ExitLoop EndSelect WEndI would use the RunWait command to ensure that each install waits on the previous one before commencing. (Put the RunWait commands where I have put MsgBoxs)Note that some installations require a reboot once installed so you may only get so many apps installed before having to re-run the script.Work fine thanks ! Link to comment Share on other sites More sharing options...
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