PPowerHouseK Posted February 15, 2011 Share Posted February 15, 2011 Hell all, I have been trying to figure out to how do this for a long time now. Basically I have a autoit script with a GUI. When a button is pushed, i need the GUI to open a new GUI that has a combo box and an okay button. I want the okay button to read the data from the combo box and return control back to the main gui. When the x button is pressed on the popup gui, it should close just that gui and not the main one as well. My problem is that i cannot get the Gui to read the input from the combo, close after okay is pressed or just close with the x. Here is the part of my main script where the second GUI should pop out. Case $secondgui $who = GUICtrlRead($input) $secondgui=GUICreate("newgui",250, 250) GUISetState() $getffs=GUICtrlCreateCombo("Choice1",0, 0, 100) $rank=GUICtrlRead($getffs) $okay=GUICtrlCreateButton("Okay",50,50,-1) Switch GUIGetMsg() Case $okay WinActivate("window") Send("{ESC}") sleep(500) Send("t") sleep(300) Send("$who & $rank2) Send("{Enter}") EndSwitch Any help would be greatly appreciated. Link to comment Share on other sites More sharing options...
AppTux Posted February 15, 2011 Share Posted February 15, 2011 I hope this will help you: #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <GUIEdit.au3> #include <StaticConstants.au3> $hGUI = GUICreate("Main GUI",500,400);Create main GUI $hButton1 = GUICtrlCreateButton("Open 2nd GUI!!",20,20, 100,20) $hLabel1 = GUICtrlCreateLabel("",20, 50, 100,20);Create label where the result is displayed GUISetState() $hGUI2 = GUICreate("Popup GUI", 200, 200);Create POPUP GUI $hButtonX = GUICtrlCreateButton("X",20,20,25,25);Create X button $hCombo = GUICtrlCreateCombo("",20,50, 100, 20);Create Combo GUICtrlSetData($hCombo, "Data1|Data2|Data3");Set data of combo GUISetState(@SW_HIDE, $hGUI2) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton1 GUISetState(@SW_SHOW, $hGUI2) Case $hButtonX $result = GUICtrlRead($hCombo) GUICtrlSetData($hLabel1, $result) GUISetState(@SW_HIDE, $hGUI2) EndSwitch WEnd PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 15, 2011 Moderators Share Posted February 15, 2011 PPowerHouseK,When the x button is pressed on the popup gui, it should close just that gui and not the main one as well.I recommend the Managing Multiple GUIs tutorial in the Wiki - it shows you how to avoid that particular problem. And it might well help you with the others as well After having read the tutorial please come back if you have any further questions. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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