SwissWrist Posted November 24, 2014 Posted November 24, 2014 (edited) Hello again, I asked a question on Friday about this same GUI and got help from a fellow named MikahS. Thank you! I now hit another snag. I tried a bunch of different thing but nothing is working:( What I would like to do is if any of the cases below are met and the GO button is clicked that the dialog will close and the statements will run. The statements will basically copy an executable from the network and run it. I'm not sure if the cases have to be in the loop in my current code or outside of the loop or even something else? If I can get help with case 1 and case 2 I think I will be okay to do the rest. I hope... ;Case 1 $radio1 Statement ;Case 2: $sql8 = "" and $sql12 = "" And $radio2 And $radio5 Statement ;Case 3: $sql8 = "" and $sql12 = "" And $radio2 And $radio6 Statement ;Case 4: $sql8 = "10.3.5500.0" and $sql12 = "11.0.2100.60" And $radio2 And $radio3 And $radio5 Statement ;Case 5: $sql8 = "10.3.5500.0" and $sql12 = "11.0.2100.60" And $radio2 And $radio4 And $radio5 Statement ;Case 6: $sql8 = "10.3.5500.0" and $sql12 = "11.0.2100.60" And $radio2 And $radio3 And $radio6 Statement ;Case 7: $sql8 = "10.3.5500.0" and $sql12 = "11.0.2100.60" And $radio2 And $radio4 And $radio6 Statement expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiButton.au3> $GUI = GUICreate("Enterprise Auto Install", 300, 300) GUIStartGroup() $radio1 = GUICtrlCreateRadio("Client", 20, 30, 400, 20) $radio2 = GUICtrlCreateRadio("Client/Server", 20, 50, 400, 20) GUIStartGroup() $radio3 = GUICtrlCreateRadio("SQL Authentication", 20, 110, 400, 20) $radio4 = GUICtrlCreateRadio("Windows Authentication", 20, 130, 400, 20) GUIStartGroup() $radio5 = GUICtrlCreateRadio("Yes", 20, 190, 400, 20) $radio6 = GUICtrlCreateRadio("No", 20, 210, 400, 20) $group1 = GUICtrlCreateGroup("Install Type", 10, 10, 180, 70) $group2 = GUICtrlCreateGroup("Authentication", 10, 90, 180, 70) $group3 = GUICtrlCreateGroup("Run Dev Build?", 10, 170, 180, 70) $goButton = GUICtrlCreateButton("GO", 100, 255, 90, 30) if @OSArch = "X64" Then $slq8 = RegRead ("HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Microsoft SQL Server\SQLNCLI10\CurrentVersion\","Version") $sql12 = RegRead("HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Microsoft SQL Server\SQLNCLI11\CurrentVersion\", "Version") Else $slq8 = RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SQLNCLI10\CurrentVersion\","Version") $sql12 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SQLNCLI11\CurrentVersion\", "Version") EndIf GUISetState() GUICtrlSetState($radio1, $GUI_CHECKED) GUICtrlSetState($radio3, $GUI_DISABLE) GUICtrlSetState($radio4, $GUI_DISABLE) GUICtrlSetState($radio5, $GUI_DISABLE) GUICtrlSetState($radio6, $GUI_DISABLE) Local $msg While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $goButton Exit Case $radio1 GUICtrlSetState($radio3, $GUI_DISABLE) GUICtrlSetState($radio4, $GUI_DISABLE) GUICtrlSetState($radio5, $GUI_DISABLE) GUICtrlSetState($radio6, $GUI_DISABLE) GUICtrlSetState($radio3, $GUI_UNCHECKED) GUICtrlSetState($radio4, $GUI_UNCHECKED) GUICtrlSetState($radio6, $GUI_CHECKED) GUICtrlSetState($radio6, $GUI_UNCHECKED) Case $radio2 GUICtrlSetState($radio3, $GUI_ENABLE) GUICtrlSetState($radio4, $GUI_ENABLE) GUICtrlSetState($radio5, $GUI_ENABLE) GUICtrlSetState($radio6, $GUI_ENABLE) GUICtrlSetState($radio6, $GUI_CHECKED) EndSwitch WEnd Edited November 24, 2014 by SwissWrist
BrewManNH Posted November 24, 2014 Posted November 24, 2014 Wouldn't this be easier using checkboxes rather than radio buttons? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
MikahS Posted November 24, 2014 Posted November 24, 2014 Yes, you'll need them in the loop like so: expandcollapse popupWhile 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $goButton Select Case GUICtrlRead($radio1) = $GUI_CHECKED MsgBox(0, "", "Just radio 1 is checked") Case $slq8 = "" And $sql12 = "" And GUICtrlRead($radio2) = $GUI_CHECKED And GUICtrlRead($radio5) = $GUI_CHECKED MsgBox(0, "", "$slq8 = "" And $sql12 = "" And $radio2 And $radio6") Case $slq8 = "" And $sql12 = "" And GUICtrlRead($radio2) = $GUI_CHECKED And GUICtrlRead($radio6) = $GUI_CHECKED MsgBox(0, "", "$slq8 = "" And $sql12 = "" And $radio2 And $radio6") Case $slq8 = "10.3.5500.0" And $sql12 = "11.0.2100.60" And GUICtrlRead($radio2) = $GUI_CHECKED And GUICtrlRead($radio4) = $GUI_CHECKED And GUICtrlRead($radio5) = $GUI_CHECKED MsgBox(0, "", "$slq8 = 10.3.5500.0 And $sql12 = 11.0.2100.60 And $radio2 And $radio4 And $radio5") Case $slq8 = "10.3.5500.0" And $sql12 = "11.0.2100.60" And GUICtrlRead($radio2) = $GUI_CHECKED And GUICtrlRead($radio3) = $GUI_CHECKED And GUICtrlRead($radio6) = $GUI_CHECKED MsgBox(0, "", "$slq8 = 10.3.5500.0 And $sql12 = 11.0.2100.60 And $radio2 And $radio3 And $radio6") Case $slq8 = "10.3.5500.0" And $sql12 = "11.0.2100.60" And GUICtrlRead($radio2) = $GUI_CHECKED And GUICtrlRead($radio4) = $GUI_CHECKED And GUICtrlRead($radio6) = $GUI_CHECKED MsgBox(0, "", "$slq8 = 10.3.5500.0 And $sql12 = 11.0.2100.60 And $radio2 And $radio4 And $radio6") EndSelect Case $radio1 GUICtrlSetState($radio3, $GUI_DISABLE) GUICtrlSetState($radio4, $GUI_DISABLE) GUICtrlSetState($radio5, $GUI_DISABLE) GUICtrlSetState($radio6, $GUI_DISABLE) GUICtrlSetState($radio3, $GUI_UNCHECKED) GUICtrlSetState($radio4, $GUI_UNCHECKED) GUICtrlSetState($radio6, $GUI_CHECKED) GUICtrlSetState($radio6, $GUI_UNCHECKED) Case $radio2 GUICtrlSetState($radio3, $GUI_ENABLE) GUICtrlSetState($radio4, $GUI_ENABLE) GUICtrlSetState($radio5, $GUI_ENABLE) GUICtrlSetState($radio6, $GUI_ENABLE) GUICtrlSetState($radio6, $GUI_CHECKED) EndSwitch WEnd Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
MikahS Posted November 24, 2014 Posted November 24, 2014 Wouldn't this be easier using checkboxes rather than radio buttons? They would have to handle unchecking the other boxes themselves, instead of how radio ctrls uncheck themselves in their own group. Just my 2 cents. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
BrewManNH Posted November 24, 2014 Posted November 24, 2014 Did you read the script? It's setting radio buttons disabled and enabled as you click on them. Not very efficient when you can just check and uncheck them in a loop instead. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
MikahS Posted November 24, 2014 Posted November 24, 2014 (edited) Did you read the first post? >This is a continuation of a script that OP wants. They specifically said they would like some buttons enabled and disabled when others were used, with radio buttons. That is my only reasoning for not suggesting checkboxes. EDIT: Please let us know if you have any questions SwissWrist. Edited November 24, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
SwissWrist Posted November 24, 2014 Author Posted November 24, 2014 Thank you again, MikhaS! This seems to work great. The only issue I have is when I click the GO button the GUI does not close. One other little issue that is pre-existing is in all cases if $sql8 = "" and $sql12 = "" I would like $radio3 and $radio4 to be disabled because if SQL is not found we dont care about authentication. Thank you again for the help!
Solution MikahS Posted November 24, 2014 Solution Posted November 24, 2014 (edited) Np, it's my pleasure. Try this: expandcollapse popupLocal $SQL_verify = True ;<<<<<<<<<<<<<<<<<<<<< Flag If $slq8 = "" And $sql12 = "" Then GUICtrlSetState($radio3, $GUI_DISABLE) GUICtrlSetState($radio4, $GUI_DISABLE) $SQL_verify = False ;<<<<<<<<<<<<<<<<<<<<<<<< If empty strings make the verify flag false EndIf While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $goButton Select Case GUICtrlRead($radio1) = $GUI_CHECKED MsgBox(0, "", "Just radio 1 is checked") Exit Case $slq8 = "" And $sql12 = "" And GUICtrlRead($radio2) = $GUI_CHECKED And GUICtrlRead($radio5) = $GUI_CHECKED MsgBox(0, "", "$slq8 = "" And $sql12 = "" And $radio2 And $radio6") Exit Case $slq8 = "" And $sql12 = "" And GUICtrlRead($radio2) = $GUI_CHECKED And GUICtrlRead($radio6) = $GUI_CHECKED MsgBox(0, "", "$slq8 = "" And $sql12 = "" And $radio2 And $radio6") Exit Case $slq8 = "10.3.5500.0" And $sql12 = "11.0.2100.60" And GUICtrlRead($radio2) = $GUI_CHECKED And GUICtrlRead($radio4) = $GUI_CHECKED And GUICtrlRead($radio5) = $GUI_CHECKED MsgBox(0, "", "$slq8 = 10.3.5500.0 And $sql12 = 11.0.2100.60 And $radio2 And $radio4 And $radio5") Exit Case $slq8 = "10.3.5500.0" And $sql12 = "11.0.2100.60" And GUICtrlRead($radio2) = $GUI_CHECKED And GUICtrlRead($radio3) = $GUI_CHECKED And GUICtrlRead($radio6) = $GUI_CHECKED MsgBox(0, "", "$slq8 = 10.3.5500.0 And $sql12 = 11.0.2100.60 And $radio2 And $radio3 And $radio6") Exit Case $slq8 = "10.3.5500.0" And $sql12 = "11.0.2100.60" And GUICtrlRead($radio2) = $GUI_CHECKED And GUICtrlRead($radio4) = $GUI_CHECKED And GUICtrlRead($radio6) = $GUI_CHECKED MsgBox(0, "", "$slq8 = 10.3.5500.0 And $sql12 = 11.0.2100.60 And $radio2 And $radio4 And $radio6") Exit EndSelect Case $radio1 If $SQL_verify = True Then ;<<<<<<<<<<<<<<<<<<<<<<<< check the flag GUICtrlSetState($radio3, $GUI_DISABLE) GUICtrlSetState($radio4, $GUI_DISABLE) EndIf GUICtrlSetState($radio5, $GUI_DISABLE) GUICtrlSetState($radio6, $GUI_DISABLE) GUICtrlSetState($radio3, $GUI_UNCHECKED) GUICtrlSetState($radio4, $GUI_UNCHECKED) GUICtrlSetState($radio6, $GUI_CHECKED) GUICtrlSetState($radio6, $GUI_UNCHECKED) Case $radio2 If $SQL_verify = True Then ;<<<<<<<<<<<<<<<<<<<<<<<< check the flag GUICtrlSetState($radio3, $GUI_ENABLE) GUICtrlSetState($radio4, $GUI_ENABLE) EndIf GUICtrlSetState($radio5, $GUI_ENABLE) GUICtrlSetState($radio6, $GUI_ENABLE) GUICtrlSetState($radio6, $GUI_CHECKED) EndSwitch WEnd That should make it so whenever you click the go button it should delete the GUI and stop the script. If you wanted the script to keep going, use GUIDelete($GUI) instead of Exit. Also, above the while loop is the check for the SQL is not found, and then disable if that is the case. Edited November 24, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
SwissWrist Posted November 24, 2014 Author Posted November 24, 2014 Thank you. I previously tried the if statement with SQL. The problem is when I select the $radio2 button, $radio3 and $radio4 still become enabled on systems that do not have sql. I believe it is because of the $radio2 cases in the loop.
MikahS Posted November 24, 2014 Posted November 24, 2014 see Post #8 for the updated solution. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
SwissWrist Posted November 25, 2014 Author Posted November 25, 2014 Thanks a million MakahS. Works perfect. Gracias!
MikahS Posted November 25, 2014 Posted November 25, 2014 My pleasure. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
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