HHCory Posted January 21, 2006 Author Posted January 21, 2006 So im Guessing that the way i have coded the duel If statements will not work then I am really starting to learn how to piece together the puzzle that is AutoIt. [u]ComboBox RadioButton Help.au3[/u]
Moderators SmOke_N Posted January 21, 2006 Moderators Posted January 21, 2006 Not without an EndIf for the other starting 'if's':If GUICtrlRead($Radio1) = 'Firefox' Then If GUICtrlRead($Combo_1) = '3-Point Shooter' Then Run('"C:\Program Files\Mozilla Firefox\firefox.exe" www.google.com' EndIf If GUICtrlRead($Radio2) = 'Internet Explorer' Then If GUICtrlRead($Combo_1) = '3-Point Shooter' Then Run('"C:\Program Files\Internet Explorer\IExplore.exe" www.google.com') EndIf Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
HHCory Posted January 21, 2006 Author Posted January 21, 2006 well i dont get the errors anymore. but now the button does not execute. here is my updated script #include <GuiConstants.au3> GUICreate("", 300, 300,) $Combo_1 = GUICtrlCreateCombo("", 10, 10, 150, 21) GUICtrlSetData($Combo_1, 'Google') $Button1 = GUICtrlCreateButton('GO', 35, 35, 100, 17) ;RADIO BUTTONS $Radio1 = GuiCtrlCreateRadio("Firefox", 100, 140, 180) GuiCtrlSetState(-1, $GUI_CHECKED) $Radio2 = GuiCtrlCreateRadio("Internet Explorer", 100, 165, 180) GUISetState() While 1 $MainMsg = GUIGetMsg() Select Case $MainMsg = $GUI_EVENT_CLOSE Exit Case $MainMsg = $Button1 If GUICtrlRead($Radio1) = 'Firefox' Then If GUICtrlRead($Combo_1) = '3-Point Shooter' Then Run('"C:\Program Files\Mozilla Firefox\firefox.exe" www.google.com' EndIf If GUICtrlRead($Radio2) = 'Internet Explorer' Then If GUICtrlRead($Combo_1) = '3-Point Shooter' Then Run('"C:\Program Files\Internet Explorer\IExplore.exe" www.google.com') EndIf EndSelect WEnd I am really starting to learn how to piece together the puzzle that is AutoIt. [u]ComboBox RadioButton Help.au3[/u]
Moderators SmOke_N Posted January 22, 2006 Moderators Posted January 22, 2006 (edited) well i dont get the errors anymore. but now the button does not execute. here is my updated script #include <GuiConstants.au3> GUICreate("", 300, 300,) $Combo_1 = GUICtrlCreateCombo("", 10, 10, 150, 21) GUICtrlSetData($Combo_1, 'Google') $Button1 = GUICtrlCreateButton('GO', 35, 35, 100, 17) ;RADIO BUTTONS $Radio1 = GuiCtrlCreateRadio("Firefox", 100, 140, 180) GuiCtrlSetState(-1, $GUI_CHECKED) $Radio2 = GuiCtrlCreateRadio("Internet Explorer", 100, 165, 180) GUISetState() While 1 $MainMsg = GUIGetMsg() Select Case $MainMsg = $GUI_EVENT_CLOSE Exit Case $MainMsg = $Button1 If GUICtrlRead($Radio1) = 'Firefox' Then If GUICtrlRead($Combo_1) = '3-Point Shooter' Then Run('"C:\Program Files\Mozilla Firefox\firefox.exe" www.google.com' EndIf If GUICtrlRead($Radio2) = 'Internet Explorer' Then If GUICtrlRead($Combo_1) = '3-Point Shooter' Then Run('"C:\Program Files\Internet Explorer\IExplore.exe" www.google.com') EndIf EndSelect WEnd To be honest, I never checked anything but your 'If' statements... The 'GUICtrlRead()' for the Radio button will return a '4' if it is unchecked and a '1' if it is checked, not the 'Text'. So... you could do this: #include <GuiConstants.au3> GUICreate("", 300, 300,) $Combo_1 = GUICtrlCreateCombo("", 10, 10, 150, 21) GUICtrlSetData($Combo_1, 'Google') $Button1 = GUICtrlCreateButton('GO', 35, 35, 100, 17) ;RADIO BUTTONS $Radio1 = GuiCtrlCreateRadio("Firefox", 100, 140, 180) GuiCtrlSetState(-1, $GUI_CHECKED) $Radio2 = GuiCtrlCreateRadio("Internet Explorer", 100, 165, 180) GUISetState() While 1 $MainMsg = GUIGetMsg() Select Case $MainMsg = $GUI_EVENT_CLOSE Exit Case $MainMsg = $Button1 If GUICtrlRead($Radio1) = 1 Then If GUICtrlRead($Combo_1) = 'Google' Then Run('"C:\Program Files\Mozilla Firefox\firefox.exe" www.google.com') EndIf If GUICtrlRead($Radio2) = 1 Then If GUICtrlRead($Combo_1) = 'Google' Then Run('"C:\Program Files\Internet Explorer\IExplore.exe" www.google.com') EndIf EndSelect WEnd Edited January 22, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
HHCory Posted January 22, 2006 Author Posted January 22, 2006 (edited) accually i just found out a easier way would be this way While 1 $MainMsg = GUIGetMsg() Select Case $MainMsg = $GUI_EVENT_CLOSE Exit Case $MainMsg = $Button1 If GUICtrlRead($Radio1) = 1 and GUICtrlRead($Combo_1) = 'Google' Then Run('"C:\Program Files\Mozilla Firefox\firefox.exe" www.google.com') If GUICtrlRead($Radio2) = 1 and GUICtrlRead($Combo_1) = 'Google' Then Run('"C:\Program Files\Internet Explorer\IExplore.exe" www.google.com') Endif EndSelect WEnd Edit: Added the Finished File. Thanks for the helpComboBox_RadioButton_Help.au3 Edited January 22, 2006 by HHCory I am really starting to learn how to piece together the puzzle that is AutoIt. [u]ComboBox RadioButton Help.au3[/u]
Moderators SmOke_N Posted January 22, 2006 Moderators Posted January 22, 2006 Nice use of the 'And'. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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