Jump to content
Sign in to follow this  
Genolark

Needing assistance with Checkbox's

Recommended Posts

Genolark

I have created the Gui part of my program for use at my work. This particular part of the program is for automating the installation of multiple programs with the option to choose from a list of check boxes for the selection then once they have made there selection they click on a continue button to start installing the selected programs. the code I have so far is as follows:

Func InstallSecurityPack ()
    $frmSucurityPack = GUICreate("Select your software to be installed", 330, 195, 193, 115)
    $grpSecSoftSelect = GUICtrlCreateGroup("Security Software Selector: ", 8, 8, 313, 177)
    $chkBoxAvira = GUICtrlCreateCheckbox("Avira AntiVir", 24, 32, 97, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $chkBoxAdAware = GUICtrlCreateCheckbox("AdAware 2008", 24, 56, 97, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $chkBoxSpybot = GUICtrlCreateCheckbox("Spybot-S&&D", 24, 80, 97, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $chkBoxSpyBlast = GUICtrlCreateCheckbox("Spyware Blaster", 24, 104, 97, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $chkBoxWinDefend = GUICtrlCreateCheckbox("Windows Defender", 168, 32, 129, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $chkBoxFireFox = GUICtrlCreateCheckbox("Mozilla Firefox", 168, 56, 97, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $chkBoxGBar = GUICtrlCreateCheckbox("Google Toolbar", 168, 80, 97, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $chkBoxClean = GUICtrlCreateCheckbox("CCleaner", 168, 104, 97, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $btnContinue = GUICtrlCreateButton("Continue", 144, 144, 75, 25, 0)
    $btnCancel = GUICtrlCreateButton("Cancel", 232, 144, 75, 25, 0)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW)
    
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                CloseWin ($frmSucurityPack)
            Return
            
            Case $btnCancel
                CloseWin ($frmSucurityPack)
            Return

        EndSwitch
    WEnd

EndFunc

P.S. I am also using some custom functions to make coding a bit easier sorry.

P.S.S. This is only the one section that I needing help with BTW

Share this post


Link to post
Share on other sites
enaiman

Add this case in your loop:

Case $btnContinue
                If GUICtrlRead($chkBoxAvira) = $GUI_CHECKED Then    ;checks if $chkBoxAvira is
                    MsgBox(0, "Checked", "Avira AntiVir")           ;checked
                Else
                    MsgBox(0, "UnChecked", "Avira AntiVir")         ;not checked
                EndIf
                If GUICtrlRead($chkBoxAdAware) = $GUI_CHECKED Then
                    MsgBox(0, "Checked", "AdAware 2008")
                Else
                    MsgBox(0, "UnChecked", "AdAware 2008")
                EndIf
                ;... and so on ....

This is only an example how to check which options are checked or not.

(GuiCtrlRead - returns for a checkbox or radio the state of that control)


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
Genolark

Thanks for the reply but if I do that, using install commands instead of course, then will it go through the first installer then the next and next and so forth?

Share this post


Link to post
Share on other sites
enaiman

yep .... if the corresponding checkbox is checked of course.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
Genolark

Awesome Thanks I will give it a go and let you know if it works and 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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.