SimonMag Posted January 4, 2008 Share Posted January 4, 2008 I have modified a script from one of the forums that I would like to perform an install depending on what radio button is selected. This is for an Oracle client install, and will install the Full administrator install, or the Custom install from the radio selection. Not being a programmer I am finding it a bit difficult to find out how to launch the install after the radio button is selected and the install button is pressed. So if I click on the Admin install radio button, then the Install button - call the Admin install setup If I click the Custom Install - call the Custom install setup. CODE#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Dim $SelectedDevice = "" $ParentWin = GUICreate("Oracle 10g Client Installer", 300, 220) GUICtrlCreateGroup("Please select the Oracle Client to Install:", 20, 20, 260, 130) $Admin = GUICtrlCreateRadio("Oracle 10g - Administrator", 25, 40, 145) $Client = GUICtrlCreateRadio("Oracle 10g - Custom Client", 25, 65, 150) $Patch = GUICtrlCreateRadio("Oracle 10g 10.0.2.3 Patch", 25, 90, 145) $Fix = GUICtrlCreateRadio("Oracle ODBC Bug Fix", 25, 115, 150) $InstallButton = GUICtrlCreateButton("Install", 20, 170, 100, 25) $ExitButton = GUICtrlCreateButton("Exit", 180, 170, 100, 25) GUICtrlSetOnEvent($ExitButton, "OnExitButton") GUICtrlSetOnEvent($InstallButton, "OnInstallButton") GUISetOnEvent($GUI_EVENT_CLOSE, "OnExitButton") GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func OnExitButton() GUIDelete($ParentWin) Exit EndFunc Func OnInstallButton() $SelectedDevice = _GetSelectedDevice() If $SelectedDevice <> "" Then _InstallTasks() EndIf EndFunc Func _GetSelectedDevice() Select Case GUICtrlRead($Admin) = $GUI_CHECKED Return "Full Administrator Install" Case GUICtrlRead($Client) = $GUI_CHECKED Return "Custom Client Install" Case GUICtrlRead($Patch) = $GUI_CHECKED Return "10.0.2.3 Patch Install" Case GUICtrlRead($Fix) = $GUI_CHECKED Return "ODBC Bugfix Install" Case Else EndSelect EndFunc Func _InstallTasks() MsgBox(64, "Selection", $SelectedDevice) EndFunc At the end of the code is a MsgBox that will display your selection, at this point I want to call the setup for that selection based on the $SelectedDevice variable. CODEFunc _InstallTasks() MsgBox(64, "Selection", $SelectedDevice) EndFunc Can anyone help? Link to comment Share on other sites More sharing options...
Monamo Posted January 4, 2008 Share Posted January 4, 2008 I have modified a script from one of the forums that I would like to perform an install depending on what radio button is selected. This is for an Oracle client install, and will install the Full administrator install, or the Custom install from the radio selection. Not being a programmer I am finding it a bit difficult to find out how to launch the install after the radio button is selected and the install button is pressed. So if I click on the Admin install radio button, then the Install button - call the Admin install setup If I click the Custom Install - call the Custom install setup. CODE#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Dim $SelectedDevice = "" $ParentWin = GUICreate("Oracle 10g Client Installer", 300, 220) GUICtrlCreateGroup("Please select the Oracle Client to Install:", 20, 20, 260, 130) $Admin = GUICtrlCreateRadio("Oracle 10g - Administrator", 25, 40, 145) $Client = GUICtrlCreateRadio("Oracle 10g - Custom Client", 25, 65, 150) $Patch = GUICtrlCreateRadio("Oracle 10g 10.0.2.3 Patch", 25, 90, 145) $Fix = GUICtrlCreateRadio("Oracle ODBC Bug Fix", 25, 115, 150) $InstallButton = GUICtrlCreateButton("Install", 20, 170, 100, 25) $ExitButton = GUICtrlCreateButton("Exit", 180, 170, 100, 25) GUICtrlSetOnEvent($ExitButton, "OnExitButton") GUICtrlSetOnEvent($InstallButton, "OnInstallButton") GUISetOnEvent($GUI_EVENT_CLOSE, "OnExitButton") GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func OnExitButton() GUIDelete($ParentWin) Exit EndFunc Func OnInstallButton() $SelectedDevice = _GetSelectedDevice() If $SelectedDevice <> "" Then _InstallTasks() EndIf EndFunc Func _GetSelectedDevice() Select Case GUICtrlRead($Admin) = $GUI_CHECKED Return "Full Administrator Install" Case GUICtrlRead($Client) = $GUI_CHECKED Return "Custom Client Install" Case GUICtrlRead($Patch) = $GUI_CHECKED Return "10.0.2.3 Patch Install" Case GUICtrlRead($Fix) = $GUI_CHECKED Return "ODBC Bugfix Install" Case Else EndSelect EndFunc Func _InstallTasks() MsgBox(64, "Selection", $SelectedDevice) EndFunc At the end of the code is a MsgBox that will display your selection, at this point I want to call the setup for that selection based on the $SelectedDevice variable. Func _InstallTasks() MsgBox(64, "Selection", $SelectedDevice) EndFunc Can anyone help? I'd just simplify it by moving the Select...Case to your OnInstallButton() function: CODE#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Dim $SelectedDevice = "" $ParentWin = GUICreate("Oracle 10g Client Installer", 300, 220) GUICtrlCreateGroup("Please select the Oracle Client to Install:", 20, 20, 260, 130) $Admin = GUICtrlCreateRadio("Oracle 10g - Administrator", 25, 40, 145) $Client = GUICtrlCreateRadio("Oracle 10g - Custom Client", 25, 65, 150) $Patch = GUICtrlCreateRadio("Oracle 10g 10.0.2.3 Patch", 25, 90, 145) $Fix = GUICtrlCreateRadio("Oracle ODBC Bug Fix", 25, 115, 150) $InstallButton = GUICtrlCreateButton("Install", 20, 160, 100, 25) $ExitButton = GUICtrlCreateButton("Exit", 180, 160, 100, 25) $StatusBar = GUICtrlCreateLabel("",0,200,300,20,$SS_SUNKEN) GUICtrlSetOnEvent($ExitButton, "OnExitButton") GUICtrlSetOnEvent($InstallButton, "OnInstallButton") GUISetOnEvent($GUI_EVENT_CLOSE, "OnExitButton") GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func OnExitButton() GUIDelete($ParentWin) Exit EndFunc ;==>OnExitButton Func OnInstallButton() Select Case GUICtrlRead($Admin) = $GUI_CHECKED $msgText = "Performing Full Administrator Install" GUICtrlSetData($StatusBar,$msgText) Sleep (5000) ; replace with "run" code here for installation GUICtrlSetData($StatusBar,"") Case GUICtrlRead($Client) = $GUI_CHECKED $msgText = "Performing Custom Client Install" GUICtrlSetData($StatusBar,$msgText) Sleep (5000) ; replace with "run" code here for installation GUICtrlSetData($StatusBar,"") Case GUICtrlRead($Patch) = $GUI_CHECKED $msgText = "Performing 10.0.2.3 Patch Install" GUICtrlSetData($StatusBar,$msgText) Sleep (5000) ; replace with "run" code here for installation GUICtrlSetData($StatusBar,"") Case GUICtrlRead($Fix) = $GUI_CHECKED $msgText = "Performing ODBC Bugfix Install" GUICtrlSetData($StatusBar,$msgText) Sleep (5000) ; replace with "run" code here for installation GUICtrlSetData($StatusBar,"") Case Else MsgBox(48,"Nothing selected","Please make a selection and then click the 'Install' button.") EndSelect EndFunc ;==>_GetSelectedDevice Func _InstallTasks() MsgBox(64, "Selection", $SelectedDevice) EndFunc ;==>_InstallTasks Hope that makes sense to ya. - 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...
SimonMag Posted January 4, 2008 Author Share Posted January 4, 2008 Monamo,Thanks for the help, that is exactly what Iwas looking for, Fantastic!Simon.I'd just simplify it by moving the Select...Case to your OnInstallButton() function:CODE#include <GUIConstants.au3>Opt("GUIOnEventMode", 1)Dim $SelectedDevice = ""$ParentWin = GUICreate("Oracle 10g Client Installer", 300, 220)GUICtrlCreateGroup("Please select the Oracle Client to Install:", 20, 20, 260, 130)$Admin = GUICtrlCreateRadio("Oracle 10g - Administrator", 25, 40, 145)$Client = GUICtrlCreateRadio("Oracle 10g - Custom Client", 25, 65, 150)$Patch = GUICtrlCreateRadio("Oracle 10g 10.0.2.3 Patch", 25, 90, 145)$Fix = GUICtrlCreateRadio("Oracle ODBC Bug Fix", 25, 115, 150)$InstallButton = GUICtrlCreateButton("Install", 20, 160, 100, 25)$ExitButton = GUICtrlCreateButton("Exit", 180, 160, 100, 25)$StatusBar = GUICtrlCreateLabel("",0,200,300,20,$SS_SUNKEN)GUICtrlSetOnEvent($ExitButton, "OnExitButton")GUICtrlSetOnEvent($InstallButton, "OnInstallButton")GUISetOnEvent($GUI_EVENT_CLOSE, "OnExitButton")GUISetState(@SW_SHOW)While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoopWEndFunc OnExitButton() GUIDelete($ParentWin) ExitEndFunc ;==>OnExitButtonFunc OnInstallButton() Select Case GUICtrlRead($Admin) = $GUI_CHECKED $msgText = "Performing Full Administrator Install" GUICtrlSetData($StatusBar,$msgText) Sleep (5000) ; replace with "run" code here for installation GUICtrlSetData($StatusBar,"") Case GUICtrlRead($Client) = $GUI_CHECKED $msgText = "Performing Custom Client Install" GUICtrlSetData($StatusBar,$msgText) Sleep (5000) ; replace with "run" code here for installation GUICtrlSetData($StatusBar,"") Case GUICtrlRead($Patch) = $GUI_CHECKED $msgText = "Performing 10.0.2.3 Patch Install" GUICtrlSetData($StatusBar,$msgText) Sleep (5000) ; replace with "run" code here for installation GUICtrlSetData($StatusBar,"") Case GUICtrlRead($Fix) = $GUI_CHECKED $msgText = "Performing ODBC Bugfix Install" GUICtrlSetData($StatusBar,$msgText) Sleep (5000) ; replace with "run" code here for installation GUICtrlSetData($StatusBar,"") Case Else MsgBox(48,"Nothing selected","Please make a selection and then click the 'Install' button.") EndSelectEndFunc ;==>_GetSelectedDeviceFunc _InstallTasks() MsgBox(64, "Selection", $SelectedDevice)EndFunc ;==>_InstallTasksHope that makes sense to ya. 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