speedtrooper Posted December 3, 2007 Share Posted December 3, 2007 Run button doesn't work with the checkboxes. I would really appreciate some tips on how to get this thing going since I'm stuck. expandcollapse popup#include <GUIConstants.au3> Dim $chbx[5][10] Dim $radio[5][4] Dim $tab[5],$runbt[5],$runbt2[5] $ParentWin = GUICreate("Prog Installer", 400, 350, -1, -1) $Tab1 = GUICtrlCreateTab(5, 5, 390, 340, $WS_EX_TRANSPARENT) for $tt = 0 to 4 ;for each tab $tab[0] = GUICtrlCreateTabItem("section " & $tt + 1) $group_1 = GUICtrlCreateGroup("Select Programs", 15, 40, 150, 240) $group_2 = GUICtrlCreateGroup("Select Other", 235, 40, 120, 150) for $t = 0 to 10 - 1 ; make the checkboxes $chbx[$tt][$t] = GUICtrlCreateCheckbox("PROG" & $t + 1, 30,60 + 20 * $t) next for $t2 = 0 to 4 - 1 ;make the radio buttons $radio[$tt][$t2] = GUICtrlCreateRadio("selection" & $t2 + 1, 245, 60 + 20 * $t2) Next $runbt[$tt] = guictrlcreatebutton("Run", 15,300,80,25) $runbt2[$tt] = GUICtrlCreateButton("Run", 235, 210, 80, 25) Next ;next tab GUICtrlCreateTabitem ("") ;don't forget to end tab GUISetState(@SW_SHOW) ;first find out what tab we're on $tabno = GUICtrlGetState($Tab1) for $t = 0 to 4 if $tabno = $tab[$t] then $tabno = $t;this is the tabitem we were on exitloop endif next ;Then have your while loop, but no need to keep reading the checkboxes. while 1 $msg = GUIGetMsg() for $t = 0 to 4 if $msg = $runbt[$t] then exitloop next wend for $t = 0 to 10 - 1 if GUICtrlRead($chbx[$tabno][$t]) = $GUI_ChECKED then call("APP_1" & $t + 1) next Func APP_1() ;Function for application 1 MsgBox(4096,"App 1","This is where Application 1 would run") EndFunc Func APP_2();Function for application 2 MsgBox(4096,"App 2","This is where Application 2 would run") EndFunc Func APP_3();Function for application 3 MsgBox(4096,"App 3","This is where Application 3 would run") EndFunc Func APP_4();Function for application 4 MsgBox(4096,"App 4","This is where Application 4 would run") EndFunc Func APP_5();Function for application 5 MsgBox(4096,"App 5","This is where Application 5 would run") EndFunc Func APP_6();Function for application 6 MsgBox(4096,"App 6","This is where Application 6 would run") EndFunc Func APP_7();Function for application 7 MsgBox(4096,"App 7","This is where Application 7 would run") EndFunc Func APP_8();Function for application 8 MsgBox(4096,"App 8","This is where Application 8 would run") EndFunc Func APP_9();Function for application 9 MsgBox(4096,"App 9","This is where Application 9 would run") EndFunc Func APP_10();Function for application 10 MsgBox(4096,"App 10","This is where Application 10 would run") EndFunc Link to comment Share on other sites More sharing options...
Valuater Posted December 3, 2007 Share Posted December 3, 2007 Nice use of arrays to create the GUI... just need to think along the same lines to check user input Hope this helps expandcollapse popup#include <GUIConstants.au3> Dim $chbx[6][11] Dim $radio[6][6] Dim $tab[6], $runbt[6], $runbt2[6] $ParentWin = GUICreate("Prog Installer", 400, 350, -1, -1) $Tab1 = GUICtrlCreateTab(5, 5, 390, 340, $WS_EX_TRANSPARENT) For $tt = 1 To 5 ;for each tab $tab[$tt] = GUICtrlCreateTabItem("section " & $tt) $group_1 = GUICtrlCreateGroup("Select Programs", 15, 40, 150, 240) $group_2 = GUICtrlCreateGroup("Select Other", 235, 40, 120, 150) For $t = 1 To 10 ; make the checkboxes $chbx[$tt][$t] = GUICtrlCreateCheckbox("PROG" & $t, 30, 60 + 20 * $t) Next For $t2 = 1 To 4 ;make the radio buttons $radio[$tt][$t2] = GUICtrlCreateRadio("selection" & $t2, 245, 60 + 20 * $t2) Next $runbt[$tt] = GUICtrlCreateButton("Run", 15, 300, 80, 25) $runbt2[$tt] = GUICtrlCreateButton("Run", 235, 210, 80, 25) Next ;next tab GUICtrlCreateTabItem("") ;don't forget to end tab GUISetState(@SW_SHOW) ;Then have your while loop, but no need to keep reading the checkboxes. While 1 $msg = GUIGetMsg() If $msg = -3 Then Exit For $tt = 1 To 5 If $msg = $runbt[$tt] Then For $t = 1 To 10 If _IsChecked($chbx[$tt][$t]) Then RUN_APP($tt, $t) Next EndIf If $msg = $runbt2[$tt] Then For $t = 1 To 4 If _IsChecked($radio[$tt][$t]) Then RUN_SELECT($tt, $t) Next EndIf Next WEnd Func RUN_APP($iTab, $iBox) MsgBox(4096, "Tab #" & ($iTab), "This is where Application " & $iBox & " would run" & @CRLF & GUICtrlRead($chbx[$iTab][$iBox], 1)) EndFunc ;==>RUN_APP Func RUN_SELECT($iTab, $iSel) MsgBox(4096, "Tab #" & ($iTab), "This is where Selection " & $iSel & " is picked" & @CRLF & GUICtrlRead($radio[$iTab][$iSel], 1)) EndFunc ;==>RUN_SELECT Func _IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked 8) Link to comment Share on other sites More sharing options...
speedtrooper Posted December 4, 2007 Author Share Posted December 4, 2007 (edited) Thanks for helping me out. This is exactly what I was looking for. And martin helped me out with putting the script together. Once again, thanks. EDIT: If I wanted different names for each checkbox, would this work? The only problem I have is the Array variable has incorrect number of subscripts or subscript dimension range exceeded.: And that is in this line: expandcollapse popup$chbx[$tt][$t] = GUICtrlCreateCheckbox($chbx[$t], 30, 60 + 20 * $t)oÝ÷ Øw«{l¶¡×¬¡ö«jëh×6#include <GUIConstants.au3> Dim $chbx[6][11] = [["woot1","different1","woot1","woot1","woot1","woot1","woot1","woot1","woot1","woot1"]] Dim $radio[6][6] Dim $tab[6], $runbt[6], $runbt2[6] $ParentWin = GUICreate("Prog Installer", 400, 350, -1, -1) $Tab1 = GUICtrlCreateTab(5, 5, 390, 340, $WS_EX_TRANSPARENT) For $tt = 1 To 5 ;for each tab $tab[$tt] = GUICtrlCreateTabItem("section " & $tt) $group_1 = GUICtrlCreateGroup("Select Programs", 15, 40, 150, 240) $group_2 = GUICtrlCreateGroup("Select Other", 235, 40, 120, 150) For $t = 1 To 10 ; make the checkboxes $chbx[$tt][$t] = GUICtrlCreateCheckbox($chbx[$t], 30, 60 + 20 * $t) Next For $t2 = 1 To 4 ;make the radio buttons $radio[$tt][$t2] = GUICtrlCreateRadio("selection" & $t2, 245, 60 + 20 * $t2) Next $runbt[$tt] = GUICtrlCreateButton("Run", 15, 300, 80, 25) $runbt2[$tt] = GUICtrlCreateButton("Run", 235, 210, 80, 25) Next ;next tab GUICtrlCreateTabItem("") ;don't forget to end tab GUISetState(@SW_SHOW) ;Then have your while loop, but no need to keep reading the checkboxes. While 1 $msg = GUIGetMsg() If $msg = -3 Then Exit For $tt = 1 To 5 If $msg = $runbt[$tt] Then For $t = 1 To 10 If _IsChecked($chbx[$tt][$t]) Then RUN_APP($tt, $t) Next EndIf If $msg = $runbt2[$tt] Then For $t = 1 To 4 If _IsChecked($radio[$tt][$t]) Then RUN_SELECT($tt, $t) Next EndIf Next WEnd Func RUN_APP($iTab, $iBox) MsgBox(4096, "Tab #" & ($iTab), "This is where Application " & $iBox & " would run" & @CRLF & GUICtrlRead($chbx[$iTab][$iBox], 1)) EndFunc ;==>RUN_APP Func RUN_SELECT($iTab, $iSel) MsgBox(4096, "Tab #" & ($iTab), "This is where Selection " & $iSel & " is picked" & @CRLF & GUICtrlRead($radio[$iTab][$iSel], 1)) EndFunc ;==>RUN_SELECT Func _IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Edited December 4, 2007 by speedtrooper Link to comment Share on other sites More sharing options...
speedtrooper Posted December 5, 2007 Author Share Posted December 5, 2007 Any help? Link to comment Share on other sites More sharing options...
picaxe Posted December 8, 2007 Share Posted December 8, 2007 I agree with Valauter, nice script. You need another array to hold the checkbox id's. Something like this expandcollapse popup#include <GUIConstants.au3> Dim $chbx[6][10] = [["","","","","","","","","",""], _ ["","app1","app2","app3","app4","app5","app6","app7","app8","app9"], _ ["","app1","app2","app3","app4","app5","app6","app7","app8","app9"], _ ["","app1","app2","app3","app4","app5","app6","app7","app8","app9"], _ ["","app1","app2","app3","app4","app5","app6","app7","app8","app9"], _ ["","app1","app2","app3","app4","app5","app6","app7","app8","app9"]] Dim $chbxid[6][10] Dim $radio[6][5] Dim $tab[6], $runbt[6], $runbt2[6] $ParentWin = GUICreate("Prog Installer", 400, 350, -1, -1) $Tab1 = GUICtrlCreateTab(5, 5, 390, 340, $WS_EX_TRANSPARENT) For $tt = 1 To 5 ;for each tab $tab[$tt] = GUICtrlCreateTabItem("section " & $tt) $group_1 = GUICtrlCreateGroup("Select Programs", 15, 40, 150, 240) For $t = 1 To 9 ; make the checkboxes $chbxid[$tt][$t] = GUICtrlCreateCheckbox($chbx[$tt][$t], 30, 60 + 20 * $t, 100, 15) Next GUICtrlCreateGroup ("",-99,-99,1,1) $runbt[$tt] = GUICtrlCreateButton("Run", 15, 300, 80, 25) $group_2 = GUICtrlCreateGroup("Select Other", 235, 40, 120, 150) For $t2 = 1 To 4 ;make the radio buttons $radio[$tt][$t2] = GUICtrlCreateRadio("selection" & $t2, 245, 60 + 20 * $t2) Next GUICtrlCreateGroup ("",-99,-99,1,1) $runbt2[$tt] = GUICtrlCreateButton("Run", 235, 210, 80, 25) Next ;next tab GUICtrlCreateTabItem("") ;don't forget to end tab GUISetState(@SW_SHOW) ;Then have your while loop, but no need to keep reading the checkboxes. While 1 $msg = GUIGetMsg() If $msg = -3 Then Exit For $tt = 1 To 5 If $msg = $runbt[$tt] Then For $t = 1 To 9 If _IsChecked($chbxid[$tt][$t]) Then RUN_APP($tt, $t) Next EndIf If $msg = $runbt2[$tt] Then For $t = 1 To 4 If _IsChecked($radio[$tt][$t]) Then RUN_SELECT($tt, $t) Next EndIf Next WEnd Func RUN_APP($iTab, $iBox) MsgBox(4096, "Tab #" & ($iTab), "This is where Application " & $iBox & " would run" & @CRLF & GUICtrlRead($chbxid[$iTab][$iBox], 1)) EndFunc ;==>RUN_APP Func RUN_SELECT($iTab, $iSel) MsgBox(4096, "Tab #" & ($iTab), "This is where Selection " & $iSel & " is picked" & @CRLF & GUICtrlRead($radio[$iTab][$iSel], 1)) EndFunc ;==>RUN_SELECT Func _IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Link to comment Share on other sites More sharing options...
corey822 Posted December 8, 2007 Share Posted December 8, 2007 hey with the same typ eof thing is there anyway to send the users input to say my email adress as if its a survey after a trial of a program? cheers C.W C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake Link to comment Share on other sites More sharing options...
picaxe Posted December 8, 2007 Share Posted December 8, 2007 heywith the same typ eof thing is there anyway to send the users input to say my email adress as if its a survey after a trial of a program?cheers C.WUse _ArrayToString or loop thru array(s) and concatenate to a string then email using _INetSmtpMail. Link to comment Share on other sites More sharing options...
corey822 Posted December 8, 2007 Share Posted December 8, 2007 Use _ArrayToString or loop thru array(s) and concatenate to a string then email using _INetSmtpMail.ummm lol im kinda a n00b to this sorrycheers C.W C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake Link to comment Share on other sites More sharing options...
picaxe Posted December 8, 2007 Share Posted December 8, 2007 Search the forums, just about every problem I've had, has been answered there. Post your script if you're stuck and someone will help. Link to comment Share on other sites More sharing options...
speedtrooper Posted December 13, 2007 Author Share Posted December 13, 2007 Thanks, picaxe. I did a little research on multidimensional arrays and I had something similar to your example. What I'm trying to piece together are the actions that follow through each item. Each checkbox has a text file linked to it and each tab and radio button have string value (in this case, an IP). I'm trying to figure out how can I combine all of these to work together. Here's an example of what I want it to do: When I select a tab, it immediately recognizes which tab it is at (which it does now) and reads the string value. When I click on the first checkbox and click Run button, it changes the text in the text file which is assigned to that specific checkbox. So, if I had 0.0.0.1 assigned to that specific tab and I select the first checkbox and click Run, it changes the text file which is assigned to that checkbox to the IP which is assigned to the tab (in this example 0.0.0.1). When I selct the second tab 0.0.0.2 and I do this process over again, the text in that text file changes to 0.0.0.2. Checkboxes - each of thsoe ten checkboxes are linked to a text file Tabs - assigned a value (in this case, IP) Radio buttons - assigned a value (in this casep IP) Hopefully that can clarify few things. 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