radiolover Posted January 19, 2006 Share Posted January 19, 2006 I am having problems with combo boxes and getting them to execute the write file. In this sample code the combo box will run the notebook but not the calculator. I would like to set it up to just select wich one to go to but then use a button to execute. thanks for the help comboboxhelp.au3 Link to comment Share on other sites More sharing options...
Developers Jos Posted January 19, 2006 Developers Share Posted January 19, 2006 (edited) Something like: While 1 $MainMsg = GUIGetMsg() Select Case $MainMsg = $GUI_EVENT_CLOSE Exit Case $MainMsg = $Button1;Calculator If GUIctrlread($Combo_1) = "Notepad" then Run("notepad.exe") If GUIctrlread($Combo_1) = "Calculator" then Run("calc.exe") EndSelect WEnd Edited January 19, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 19, 2006 Moderators Share Posted January 19, 2006 (edited) #include <GuiConstants.au3> GUICreate("", 170, 60,) $Combo_1 = GUICtrlCreateCombo("", 10, 10, 150, 21) GUICtrlSetData($Combo_1, 'Notepad|Calculator') $Button1 = GUICtrlCreateButton('GO', 35, 35, 100, 17) GUISetState() While 1 $MainMsg = GUIGetMsg() Select Case $MainMsg = $GUI_EVENT_CLOSE Exit Case $MainMsg = $Button1;Calculator If GUICtrlRead($Combo_1) = 'Notepad' Then Run("notepad.exe") If GUICtrlRead($Combo_1) = 'Calculator' Then Run("calc.exe") EndSelect WEnd Edit: Too Slow.... Edited January 19, 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. Link to comment Share on other sites More sharing options...
seandisanti Posted January 19, 2006 Share Posted January 19, 2006 (edited) I am having problems with combo boxes and getting them to execute the write file. In this sample code the combo box will run the notebook but not the calculator. I would like to set it up to just select wich one to go to but then use a button to execute. thanks for the help comboboxhelp.au3hey, welcome to the forum. #include <GuiConstants.au3> GUICreate("", 170, 60) GUISetState() $Combo_1 = GUICtrlCreateCombo("", 10, 10, 150, 21) GUICtrlSetData($Combo_1, 'Notepad|Calculator') $Button1 = GUICtrlCreateButton('GO', 35, 35, 100, 17) While 1 $MainMsg = GUIGetMsg() Select Case $MainMsg = $GUI_EVENT_CLOSE Exit Case $MainMsg = $Button1 Select Case GUICtrlRead($Combo_1) = "Notepad" Run("Notepad.exe") Case GUICtrlRead($Combo_1) = "Calculator" Run("Calc.exe") EndSelect EndSelect WEnd GUISetState() While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd ***edit*** wow i'm slow today.... hey smoke, you may want to count the commas on your GUICreate() Edited January 19, 2006 by cameronsdad Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 19, 2006 Moderators Share Posted January 19, 2006 (edited) No doubt... I fixed the other stuff, and didn't even look there!! Edit: Super weird it doesn't throw me an error with it like that. Edited January 19, 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. Link to comment Share on other sites More sharing options...
seandisanti Posted January 19, 2006 Share Posted January 19, 2006 No doubt... I fixed the other stuff, and didn't even look there!! Edit: Super weird it doesn't throw me an error with it like that.what didn't throw an error? it wouldn't execute like that... See, that's why i was 3rd on the responses, i was making sure mine WORKED. jdeb's wouldn't run notepad if just pasted in, because of the way the OP had "Notepad |Calculator", and yours wouldn't because of the comma... [/mock criticism in place of a valid excuse for my slow response] Link to comment Share on other sites More sharing options...
Developers Jos Posted January 19, 2006 Developers Share Posted January 19, 2006 what didn't throw an error? it wouldn't execute like that... See, that's why i was 3rd on the responses, i was making sure mine WORKED. jdeb's wouldn't run notepad if just pasted in, because of the way the OP had "Notepad |Calculator", and yours wouldn't because of the comma... [/mock criticism in place of a valid excuse for my slow response]whiner ..... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
rudika Posted January 19, 2006 Share Posted January 19, 2006 No doubt... I fixed the other stuff, and didn't even look there!!Edit: Super weird it doesn't throw me an error with it like that.Hi, you can alternate try this script:#include <GuiConstants.au3>$NotePad = 0$Calc = 0GUICreate("", 170, 60,)GUISetState()$Combo_1 = GUICtrlCreateCombo("", 10, 10, 150, 21)GUICtrlSetData($Combo_1, 'Notepad |Calculator')$Button1 = GUICtrlCreateButton('GO', 35, 35, 100, 17)While 1 $MainMsg = GUIGetMsg() Select Case $MainMsg = $GUI_EVENT_CLOSE Exit Case $MainMsg = $Combo_1 ;NotePad $NotePad = 1 $Calc = 0 Case $MainMsg = $Combo_1 ;Calculator $NotePad = 0 $Calc = 1 Case $MainMsg = $Button1 If $NotePad = 1 Then Run("notepad.exe") Exit ;???? ElseIf $Calc = 1 Then Run("calc.exe") Exit ;???? Else Exit ;???? EndIf EndSelectWEnd GUISetState() While GUIGetMsg() <> $GUI_EVENT_CLOSEWEnd [font="Comic Sans Ms"][center]Powered by AutoIt3http://www.wik-eric.de/zips/Synchro2.2.2-4free.zip[/center][/font] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 19, 2006 Moderators Share Posted January 19, 2006 Just put in the fixes that we made. Also, use code tags that are provided in the posting options.@cameronsdad, since most everything uses beta now a days, I just run the beta version, that's why I didn't get the error I suppose, because I did check it in SciTe before I posted and it ran (your just slow to respond!!) 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. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 19, 2006 Developers Share Posted January 19, 2006 (edited) Is not going to work...... Hi, you can alternate try this script: Select Case $MainMsg = $GUI_EVENT_CLOSE Exit Case $MainMsg = $Combo_1;NotePad $NotePad = 1 $Calc = 0 Case $MainMsg = $Combo_1;Calculator <== this stament is NEVER reached $NotePad = 0 <== this stament is NEVER reached $Calc = 1 <== this stament is NEVER reached Edited January 19, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
radiolover Posted January 19, 2006 Author Share Posted January 19, 2006 hey thanks for the help Link to comment Share on other sites More sharing options...
seandisanti Posted January 19, 2006 Share Posted January 19, 2006 Just put in the fixes that we made. Also, use code tags that are provided in the posting options.@cameronsdad, since most everything uses beta now a days, I just run the beta version, that's why I didn't get the error I suppose, because I did check it in SciTe before I posted and it ran (your just slow to respond!!) i only use the beta also.... so you tried it and received no error eh? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 19, 2006 Moderators Share Posted January 19, 2006 i only use the beta also.... so you tried it and received no error eh?No, I didn't get an error, but I have everything as beta, no 3.1.1 usage at all, so maybe it didn't do an Au3check, I don't know. But I do know it didn't throw an error hmm 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. Link to comment Share on other sites More sharing options...
seandisanti Posted January 19, 2006 Share Posted January 19, 2006 No, I didn't get an error, but I have everything as beta, no 3.1.1 usage at all, so maybe it didn't do an Au3check, I don't know. But I do know it didn't throw an error hmmok... you know half of my job on the forums is to give you a hard time smoke. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 19, 2006 Moderators Share Posted January 19, 2006 ok... you know half of my job on the forums is to give you a hard time smoke. And you know I'm only around half the time for your amusement 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. Link to comment Share on other sites More sharing options...
seandisanti Posted January 20, 2006 Share Posted January 20, 2006 And you know I'm only around half the time for your amusement that's why i make up for the other have by getting you twice as much when you are on. 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