ct253704 Posted July 15, 2014 Share Posted July 15, 2014 Hello. I've been having an issue getting my GUI to execute a program once a button is pushed and a certain box is checked. Here's the code and i'll post the issue in more detail below. expandcollapse popupFunc GUI () #Region ### START Koda GUI section ### Form=C:\Users\cthomas\Desktop\User Mode Checklist.kxf $Form1 = GUICreate("User Mode GUI", 403, 333, 415, 178) $Title = GUICtrlCreateLabel("User Mode Settings", 34, 16, 334, 15, $SS_CENTER) GUICtrlSetBkColor(-1, 0xA6CAF0) $Background = GUICtrlCreateCheckbox("Have Set Background", 32, 56, 145, 17) $DesktopIcons = GUICtrlCreateCheckbox("Have Set Desktop Icons", 32, 96, 145, 17) $FolderOptions = GUICtrlCreateCheckbox("Have Set Folder Options", 32, 136, 145, 17) $StartMenu = GUICtrlCreateCheckbox("Have Set Start Menu", 32, 176, 145, 17) $OfficeBars = GUICtrlCreateCheckbox("Configured Office Toolbars", 32, 216, 145, 17) $Printers = GUICtrlCreateCheckbox("Installed Printers", 232, 96, 137, 17) $RDP = GUICtrlCreateCheckbox("Have Set RDP", 232, 56, 137, 17) $ECHO = GUICtrlCreateCheckbox("Install Clinician's Desktop", 232, 136, 137, 17) $Barracuda = GUICtrlCreateCheckbox("Install Web Filter", 232, 176, 137, 17) $Install = GUICtrlCreateButton("Done", 64, 272, 99, 25) $Restart = GUICtrlCreateButton("Restart", 240, 272, 99, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $EchoValue = GUICtrlRead($ECHO) $BarracudaValue = GUICtrlRead($Barracuda) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Install Switch ($EchoValue) Case $GUI_CHECKED Run ("\\server\disks\Echo Upgrade 112613\9.1.2.4\Install_EchoWorkstation_912.exe") Case $GUI_UNCHECKED MsgBox (0, "No Echo", "Clinician's Desktop will not be installed") EndSwitch Switch ($BarracudaValue) Case $GUI_CHECKED Run ("\\server\OSCE Installers\BarracudaWSASetup.exe") Case $GUI_UNCHECKED MsgBox (0, "No Web Filter", "Barracuda Web Filter will not be installed") EndSwitch Case $Restart Run ("Shutdown -r -t 01 -f") EndSwitch WEnd EndFunc The goal: When clicking the "install" button it is supposed to install the Echo Workstation and the Barracuda web filter IF those boxes are checked. If they are unchecked it is supposed to prompt the user with a msgbox telling them the program(s) will not be installed. Now, when I check the boxes and click the Install button it instead gives me the Unchecked messagebox (meaning the code does sort of work). However, if I uncheck the boxes it still gives me the message box saying the software will not be installed. To further test I added a "Case Else" line to see if it wasn't registering checks at all and it still gave me the will not be installed message. I am assuming it is something very silly I missed, but I have looked through some samples on the forums and the help file and can't seem to pinpoint the issue. Any help would be appreciated! Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted July 15, 2014 Moderators Solution Share Posted July 15, 2014 ct253704,You are only reading the checkbox states once immediately after the GUI is created - you need to read them as the install process begins: Case $Install $EchoValue = GUICtrlRead($ECHO) $BarracudaValue = GUICtrlRead($Barracuda) Switch $EchoValue ; [...]M23 ct253704 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ct253704 Posted July 15, 2014 Author Share Posted July 15, 2014 Ohh wow that makes much more sense now. Thank you! 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