AramisResearch Posted July 13, 2006 Share Posted July 13, 2006 Here's what I am trying to accomplish: I am laying out a nice GUI setup (or trying, anyway) that will become part of a (mostly) unattended build process for a server. Part of the process requires initial user input to provide the server's name, IP address, what domain it goes into, a domain admin account and password, and some other stuff. The way I WAS doing it was a long list of VBS InputBox bits, looped to avoid blank input (though not very mistake-proof), and the input value gets dumped to the registry for later reading by the same script. What I would LIKE is a nice GUI box with radio buttons for certain pre-determined choices and blanks to type certain other kinds of values into that are not a simple choice (like an IP address). I would like to let the user make choices from all the radio button groups, type in the stuff that needs to be typed in, and then click on "Submit" and have the script read all the choices and other typed input and dump them to some specified location in HKLM\Software so I can read it back later in the process. It would also be really cool if the Submit button could be made unavailable until every radio button group and field is filled in. I would also like to get rid of the X in the top right corner so the box can't be closed forcibly and the user has no real choice but to enter the data and click submit. Here is what I have so far: #include <GuiConstants.au3> GuiCreate("Citrix Server System Setup GUI",500, 700) $ServerName = GuiCtrlCreateLabel("Server Name", 5, 5, 150, 18) $Input_ServerName = GuiCtrlCreateInput("", 75, 5, 100, 18) $DomainName = GuiCtrlCreateLabel("Domain Name", 5, 35, 150, 18) $Input_DomainName = GuiCtrlCreateInput("", 75, 35, 100, 18) GuiCtrlCreateGroup("Agency", 5, 70, 100, 100) GuiCtrlCreateRadio("OCFS", 10, 95) GuiCtrlCreateRadio("OFT", 10, 125) GUICtrlCreateGroup("", -99, -99, 1, 1) GuiCtrlCreateGroup("Prod/Test", 105, 70, 100, 100) GuiCtrlCreateRadio("Prod", 110, 95) GuiCtrlCreateRadio("Test", 110, 125) GUICtrlCreateGroup("", -99, -99, 1, 1) GuiCtrlCreateGroup("Model Type", 205, 70, 100, 100) GuiCtrlCreateRadio("8837", 210, 95) GuiCtrlCreateRadio("M8837", 210, 125) GUICtrlCreateGroup("", -99, -99, 1, 1) GuiCtrlCreateGroup("Re-Image?", 305, 70, 100, 100) GuiCtrlCreateRadio("Yes", 310, 95) GuiCtrlCreateRadio("No", 310, 125) GUICtrlCreateGroup("", -99, -99, 1, 1) $SubmitButton = GUICtrlCreateButton ("Submit", 25, 660, 70,20) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $SubmitButton RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\CCS", "Servername", "REG_SZ", $Input_ServerName) RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\CCS", "Domain", "REG_SZ", $Input_DomainName) ExitLoop Case Else ;;; EndSelect WEnd As you can see, this is far from complete. The question I have to begin with is this: How do I associate the value selected in a given radio button group with one variable whose value I can dump to the registry. For example, in the first group where you must select an agency (I work as a contractor for a state agency) I would like the user to have to select "OCFS" or "OFT", assign the value OCFS or OFT to some variable name like $AgencyName, and then do a RegWrite that stuffs the value into the registry. As you can probably tell, I have made a pretty (well, sort of) box with buttons and blanks, but little else. Any assistance would be much appreciated. Thanks, -Chris Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 13, 2006 Share Posted July 13, 2006 HI, one step : expandcollapse popup#include <GuiConstants.au3> GuiCreate("Citrix Server System Setup GUI",500, 400) $ServerName = GuiCtrlCreateLabel("Server Name", 5, 5, 150, 18) $Input_ServerName = GuiCtrlCreateInput("", 75, 5, 100, 18) $DomainName = GuiCtrlCreateLabel("Domain Name", 5, 35, 150, 18) $Input_DomainName = GuiCtrlCreateInput("", 75, 35, 100, 18) GuiCtrlCreateGroup("Agency", 5, 70, 100, 100) $ocfs_R = GuiCtrlCreateRadio("OCFS", 10, 95) $oft_R = GuiCtrlCreateRadio("OFT", 10, 125) GUICtrlCreateGroup("", -99, -99, 1, 1) GuiCtrlCreateGroup("Prod/Test", 105, 70, 100, 100) GuiCtrlCreateRadio("Prod", 110, 95) GuiCtrlCreateRadio("Test", 110, 125) GUICtrlCreateGroup("", -99, -99, 1, 1) GuiCtrlCreateGroup("Model Type", 205, 70, 100, 100) GuiCtrlCreateRadio("8837", 210, 95) GuiCtrlCreateRadio("M8837", 210, 125) GUICtrlCreateGroup("", -99, -99, 1, 1) GuiCtrlCreateGroup("Re-Image?", 305, 70, 100, 100) GuiCtrlCreateRadio("Yes", 310, 95) GuiCtrlCreateRadio("No", 310, 125) GUICtrlCreateGroup("", -99, -99, 1, 1) $SubmitButton = GUICtrlCreateButton ("Submit", 25, 360, 70,20) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $SubmitButton If GUICtrlRead($ocfs_R) = $GUI_CHECKED Then MsgBox(0,"", "$ocfs_R is checked!") If GUICtrlRead($oft_R) = $GUI_CHECKED Then MsgBox(0,"", "$oft_R is checked!") ;RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\CCS", "Servername", "REG_SZ", $Input_ServerName) ;RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\CCS", "Domain", "REG_SZ", $Input_DomainName) ExitLoop Case Else ;;; EndSelect WEnd So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Daniel D. Posted October 16, 2006 Share Posted October 16, 2006 (edited) I'm writing a script to install some tools. I created the GUI and three tabs - each with a radio button list (not ready yet). After choosing a tool and press "Install", a short MsgBox should appear and ask if I really want to install it. How can I check which button I chose? I tried it with the given code, but it doesn't work. Another question: Do I have to "close" a group/tab (look at the comment below my groups/tabs)? expandcollapse popup#include <GUIConstants.au3> GUICreate ("Installer", 300, 300) $tab=GUICtrlCreateTab (5, 5, 290, 290) $tab0=GUICtrlCreateTabItem ("System") GUICtrlSetState(-1,$GUI_SHOW) GUICtrlCreateGroup ("Please choose one...", 15, 30, 270, 255) $radio1=GUICtrlCreateRadio ("AdAware SE", 25, 50, 150, 20) $info1=GUICtrlCreateButton ("Info", 175, 50, 40, 20) $radio2=GUICtrlCreateRadio ("Adobe Reader", 25, 75, 150, 20) $info2=GUICtrlCreateButton ("Info", 175, 75, 40, 20) $radio3=GUICtrlCreateRadio ("AntiVir", 25, 100, 150, 20) $info3=GUICtrlCreateButton ("Info", 175, 100, 40, 20) $radio4=GUICtrlCreateRadio ("Google Earth", 25, 125, 150, 20) $info4=GUICtrlCreateButton ("Info", 175, 125, 40, 20) $radio5=GUICtrlCreateRadio ("IZArc", 25, 150, 150, 20) $info5=GUICtrlCreateButton ("Info", 175, 150, 40, 20) $install_1=GUICtrlCreateButton ("Install...", 100, 250, 100, 30) ;GUICtrlCreateGroup ("") ;------------------------------------------------------------------------------- $tab1=GUICtrlCreateTabItem ("Internet") ;------------------------------------------------------------------------------- $tab2=GUICtrlCreateTabItem ("Multimedia") ;------------------------------------------------------------------------------- GUICtrlCreateTabItem ("") GUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $install_1 if GUICtrlRead($radio1) = $GUI_Checked Then MsgBox(0, "", "Install" & $radio1) EndSelect Wend Edited October 16, 2006 by Daniel D. Link to comment Share on other sites More sharing options...
martin Posted October 16, 2006 Share Posted October 16, 2006 @Daniel D Welcome to the forum. You have asked something which is not related to the thread so you should start a new thread with your question. Anyway, your code seems to work so you need to explain the probelm in a bit more detail. (But start a new thread first.) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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