Xonos Posted March 7, 2008 Share Posted March 7, 2008 Ok, I have written several scripts to install programs automatically that I use every day! Now, just to add some cool professionalism to my scripts I have got into GUIs... If someone would be so kind as in to provide some guidance to me. I am newb at coding... Anywho, here is my code. #include <GUIConstants.au3> GUICreate("Vision Install Center", 255, 110, 255, 255) GUICtrlCreateLabel("Please select which type of vision you wish to install.", 5, 5) GUICtrlCreateButton("Install", 95, 75, 60) GUICtrlCreateCombo ("Student", 93,40, 65) GUICtrlSetData(-1,"Master") $background = GUICtrlCreatePic ("vsion.JPG", 5, 30, 42, 39) GUISetState () GUISetState (@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Ok, the combo has 2 drop down items.. Student and Master. Basically this is what I want it to do! If I click student and then click the install button.. It will then close this window and launch another executable with the "run("blah.exe")" command. If I click master and click install, it will use the run command for a different executable and also close this window. I understand so far how to close the window.. I can use processkill("myexe.exe") and I can run seperate executables with the Run command but what I don't know is how to connect the drop down box content with the install button. Or even how to make the install button do something. Anyone mind sharing some light? [center][/center][center]Xonos Development[font=trebuchet ms,helvetica,sans-serif]- Resources -[/font]AutoIT Documentation | Active Directory UDF | Windows Services UDF | Koda GUI Designer[/center] Link to comment Share on other sites More sharing options...
Monamo Posted March 7, 2008 Share Posted March 7, 2008 Ok, I have written several scripts to install programs automatically that I use every day! Now, just to add some cool professionalism to my scripts I have got into GUIs... If someone would be so kind as in to provide some guidance to me. I am newb at coding... Anywho, here is my code. #include <GUIConstants.au3> GUICreate("Vision Install Center", 255, 110, 255, 255) GUICtrlCreateLabel("Please select which type of vision you wish to install.", 5, 5) GUICtrlCreateButton("Install", 95, 75, 60) GUICtrlCreateCombo ("Student", 93,40, 65) GUICtrlSetData(-1,"Master") $background = GUICtrlCreatePic ("vsion.JPG", 5, 30, 42, 39) GUISetState () GUISetState (@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Ok, the combo has 2 drop down items.. Student and Master. Basically this is what I want it to do! If I click student and then click the install button.. It will then close this window and launch another executable with the "run("blah.exe")" command. If I click master and click install, it will use the run command for a different executable and also close this window. I understand so far how to close the window.. I can use processkill("myexe.exe") and I can run seperate executables with the Run command but what I don't know is how to connect the drop down box content with the install button. Or even how to make the install button do something. Anyone mind sharing some light? You'd just want to take what you already have and assign variables for your creation of the controls (in this case, your "Install" button and your combobox). Here's an example: CODE #include <GUIConstants.au3> GUICreate("Vision Install Center", 255, 110, 255, 255) GUICtrlCreateLabel("Please select which type of vision you wish to install.", 5, 5) $buttonInstall = GUICtrlCreateButton("Install", 95, 75, 60) $comboInstallType = GUICtrlCreateCombo("Student", 93, 40, 65, $CBS_DROPDOWN) GUICtrlSetData($comboInstallType, "Master", "Student") $background = GUICtrlCreatePic("vsion.JPG", 5, 30, 42, 39) GUISetState() GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $buttonInstall If GUICtrlRead($comboInstallType) = "Student" Then _StudentInstall() Else _MasterInstall() EndIf ExitLoop EndSelect WEnd Func _StudentInstall() ;student installation code EndFunc Func _MasterInstall() ;master installation code EndFunc - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
Xonos Posted March 7, 2008 Author Share Posted March 7, 2008 Ahh man Gui Read.. I never thought of that.. Thanks a lot!!! I appreciate your help... [center][/center][center]Xonos Development[font=trebuchet ms,helvetica,sans-serif]- Resources -[/font]AutoIT Documentation | Active Directory UDF | Windows Services UDF | Koda GUI Designer[/center] 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