Sign in to follow this  
Followers 0
Wolffe

I think that I fried a brain cell

3 posts in this topic

But I can't seem to get this figured out. Here is what I am trying (unsuccessfully) to do. I am trying to have a gui with a bunch of checkboxes come up with an 'install checked' button at the bottom. What I would like to have happen, would be, you choose which items you would like to install by using the checkboxes and when you click the install checked button it installs those particular features. Now, I am still in the begining stage where I am trying to get the gui part to work. And at least recognize which boxes are checked. I did do a search through the forum and found some interesting/handy ideas. And I think that screwed me up more as I tried to figure out how to integrate them. Anyway, any ideas would be handy.

CODE

#include <GuiConstants.au3>

#include <Array.au3>

Global $Button_MakeReport, $Checkbox_1, $Checkbox_2, $Checkbox_3, $Checkbox_4, $choice[6], $outstring

GuiCreate("Installation", 165, 210,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GuiCtrlCreateButton("Install Checked", 35, 170, 100, 30)

GUICtrlSetOnEvent(-1, "OK")

$Checkbox_1 = GUICtrlCreateCheckbox("this Software", 20, 10, 100, 30)

GUICtrlSetOnEvent(-1, "chkstr")

$Checkbox_2 = GUICtrlCreateCheckbox("Manuals", 50, 35, 100, 30)

GUICtrlSetOnEvent(-1, "chkstr")

$Checkbox_3 = GUICtrlCreateCheckbox("Event Log", 20, 60, 100, 30)

GUICtrlSetOnEvent(-1, "chkstr")

$Checkbox_4 = GUICtrlCreateCheckbox("User Accounts", 20, 85, 100, 30)

GUICtrlSetOnEvent(-1, "chkstr")

$Checkbox_5 = GUICtrlCreateCheckbox("Internet Options", 20, 110, 100, 30)

GUICtrlSetOnEvent(-1, "chkstr")

$Checkbox_6 = GUICtrlCreateCheckbox("MSConfig", 20, 135, 100, 30)

GUICtrlSetOnEvent(-1, "chkstr")

$installstring= ""

Func chkstr()

Select

Case @GUI_CTRLID = $Checkbox_1

$Checkbox_1 = GUICtrlRead($Checkbox_1)

If $Checkbox_1= $GUI_UNCHECKED Then

$choice[0] = ""

ElseIf $Checkbox_1= $GUI_CHECKED Then

$choice[0] = "this Software"

EndIf

Case @GUI_CTRLID = $Checkbox_2

$Checkbox_2 = GUICtrlRead($Checkbox_2)

If $Checkbox_2 = $GUI_UNCHECKED Then

$choice[1] = ""

ElseIf $Checkbox_2 = $GUI_CHECKED Then

$choice[1] = "Manuals"

EndIf

Case @GUI_CTRLID = $Checkbox_3

$Checkbox_3 = GUICtrlRead($Checkbox_3)

If $Checkbox_3 = $GUI_UNCHECKED Then

$choice[2] = ""

ElseIf $Checkbox_3 = $GUI_CHECKED Then

$choice[2] = "Event Log"

EndIf

Case @GUI_CTRLID = $Checkbox_4

$Checkbox_4 = GUICtrlRead($Checkbox_4)

If $Checkbox_4 = $GUI_UNCHECKED Then

$choice[3] = ""

ElseIf $Checkbox_4 = $GUI_CHECKED Then

$choice[3] = "User Accounts"

EndIf

Case @GUI_CTRLID = $Checkbox_5

$Checkbox_5 = GUICtrlRead($Checkbox_5)

If $Checkbox_5 = $GUI_UNCHECKED Then

$choice[4] = ""

ElseIf $Checkbox_5 = $GUI_CHECKED Then

$choice[4] = "Internet Options"

EndIf

Case @GUI_CTRLID = $Checkbox_6

$Checkbox_6 = GUICtrlRead($Checkbox_6)

If $Checkbox_6 = $GUI_UNCHECKED Then

$choice[5] = ""

ElseIf $Checkbox_6 = $GUI_CHECKED Then

$choice[5] = "MSConfig"

EndIf

EndSelect

EndFunc

Share this post


Link to post
Share on other sites



But I can't seem to get this figured out. Here is what I am trying (unsuccessfully) to do. I am trying to have a gui with a bunch of checkboxes come up with an 'install checked' button at the bottom. What I would like to have happen, would be, you choose which items you would like to install by using the checkboxes and when you click the install checked button it installs those particular features. Now, I am still in the begining stage where I am trying to get the gui part to work. And at least recognize which boxes are checked. I did do a search through the forum and found some interesting/handy ideas. And I think that screwed me up more as I tried to figure out how to integrate them. Anyway, any ideas would be handy.

I think you got your process backwards. Your 'go' button, labeled "Install Checked" has an event tagged to it to call the function OK(), which doesn't exist. Your checkboxes have events attached to them, when they don't need any. The idea would be to:

1. Create the GUI (with event mode enabled, you didn't)

2. Show the GUI (I didn't see an GuiSetState() in there)

3. Loop waiting for the button to get clicked, which calls the OK() function

4. Have the OK() function check the state of the checkboxes and act accordingly

Hope that helps.

:shocked:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Thanks a lot for the help. I seem to have it working. It might not be pretty but it seems to work. :-) Thanks again!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0