litlmike Posted February 22, 2006 Share Posted February 22, 2006 Im kinda new to this, so please forgive my erroneous ways.Looking to do the following:Make a GUI that allows the user to select/type a few things, so that my other script can paste the info into the appropriate fields. So, GUI opens, and the user can choose from 1 of 3 drop-down boxes (no more than 1), and also enter in a 'Discount'. The info would need to be stored in a variable for pasting later. Please help. Here is what I have so far, but I think I am way off track, and its probably all crap. I am sure there are some easier ways to accomplish this. Feel free to scrap it all.#include <GUIConstants.au3>;declare variables for category and discount;; not sure i need thisDim $val_cat1,$val_discountGUICreate ( "Select a Category", 400, 300) ; will create a dialog box that when displayed is centeredGUISetState (@SW_SHOW) ; will display an empty dialog boxGUICtrlCreateCombo ("Category 1 Title",10,10, 200)GUICtrlSetData(-1,"Option 1|Option 2|Option 3") ; add other item; i need 30 options, is the only way to type them all out?GUICtrlCreateCombo ("Category 2 Title",10,50, 200)GUICtrlSetData(-1,"Option 1b|Option 2b|Option 3b") ; add other itemGUICtrlCreateCombo ("Category 3 Title",10,90, 200)GUICtrlSetData(-1,"Option 1c|Option 2c|Option 3c|") ; add other item$val_discount = GUICtrlCreateInput ( "Enter Discount", 10, 130, 200) ;;think this is wrong too; Run the GUI until the dialog is closedWhile 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoopWend _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
supraaxdd Posted May 9, 2019 Share Posted May 9, 2019 @litlmike, Try this: expandcollapse popup#include <GUIConstants.au3> ;declare variables for category and discount;; not sure i need this $vMainGUI = GUICreate ( "Select a Category", 400, 300) ; will create a dialog box that when displayed is centered $ButtonExit = GUICtrlCreateButton("Exit", 310, 260, 80, 30) $ButtonConfirm = GUICtrlCreateButton("Proceed", 220, 260, 80, 30) $vOptionSelOne = GUICtrlCreateCombo ("Category 1 Title",10,10, 200) GUICtrlSetData(-1,"Option 1|Option 2|Option 3") ; add other item; i need 30 options, is the only way to type them all out? $vOptionSelTwo = GUICtrlCreateCombo ("Category 2 Title",10,50, 200) GUICtrlSetData(-1,"Option 1b|Option 2b|Option 3b") ; add other item $vOptionSelThree = GUICtrlCreateCombo ("Category 3 Title",10,90, 200) GUICtrlSetData(-1,"Option 1c|Option 2c|Option 3c|") ; add other item $val_discount = GUICtrlCreateInput ( "Enter Discount", 10, 130, 200) ;;think this is wrong too GUISetState (@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $ButtonExit Exit Case $ButtonConfirm ComboRead($vOptionSelOne, $vOptionSelTwo, $vOptionSelThree) EndSwitch Wend Func ComboRead($Option, $Option2, $Option3) ;This function checks what is chosen in the combobox and stores it as a variable. If $Option = $vOptionSelOne Then Global $sel = GUICtrlRead($Option) If $sel = "Option 1" Then $sel = "Option 1" ElseIf $sel = "Option 2" Then $sel = "Option 2" ElseIf $sel = "Option 3" Then $sel = "Option 3" EndIf EndIf MsgBox(0,"","You have selected " & $sel) If $Option2 = $vOptionSelTwo Then Global $sel2 = GUICtrlRead($Option2) If $sel2 = "Option 1b" Then $sel2 = "Option 1b" ElseIf $sel2 = "Option 2b" Then $sel2 = "Option 2b" ElseIf $sel2 = "Option 3b" Then $sel2 = "Option 3b" EndIf EndIf MsgBox(0,"","You have selected " & $sel2) If $Option3 = $vOptionSelThree Then Global $sel3 = GUICtrlRead($Option3) If $sel3 = "Option 1c" Then $sel3 = "Option 1c" ElseIf $sel3 = "Option 2c" Then $sel3 = "Option 2c" ElseIf $sel3 = "Option 3c" Then $sel3 = "Option 3c" EndIf EndIf MsgBox(0,"","You have selected " & $sel3) Global $discount = GUICtrlRead($val_discount) MsgBox(0,"","You have selected " & $discount) EndFunc ;==> ComboRead Reply to me if this works out for you! Regards, Supra Link to comment Share on other sites More sharing options...
supraaxdd Posted May 9, 2019 Share Posted May 9, 2019 I also kind of realised I replied to an old post, but oh well 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