Jump to content

Needing assistance with Checkbox's


Recommended Posts

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

Link to comment
Share on other sites

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 :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...