mdb Posted August 17, 2009 Share Posted August 17, 2009 (edited) I can't figure out what I'm doing wrong. I'm totally new to AutoIt and just playing around with making a GUI, I took out a lot of the code I have to get help with this specific issue. I'm not sure if theres any better way to do what I'm trying to do. Basically I just want the thing to exit when I click Exit in the menu, but its just not doing that . At first Main() didn't exist, as I tried to do this outside of a Function and it wasn't working. Now inside of one, and it still isn't working. I'm not really sure which way is easier when you get into lengthy programs. Should I even use Select? I tried it without that, and it just wasn't working, so I decided to add it in, and it still isn't working. Even tried to ignore the function and just put 'Exit 0' in there.. Same outcome. I know someone is going to facepalm and tell me to use search, but I don't even know where to begin. #include <GuiConstantsEx.au3> GuiCreate("Test", 280,100) HotKeySet ("{F1}", "Terminate") Main() GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd Func Main() $menu = GuiCtrlCreateMenu("Menu") $terminate = GuiCtrlCreateMenuItem("Exit",$menu) EndFunc Func terminate() Exit 0 EndFunc Thanks a bunch for reading >_< ((Deleted even more garbage coding)) Edited August 17, 2009 by mdb Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 17, 2009 Moderators Share Posted August 17, 2009 mdb,First, welcome to the AutoIt forums.Reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here.As to your code, it just needs a bit of tidying:#include <GuiConstantsEx.au3> HotKeySet ("{F1}", "Terminate") GuiCreate("Test", 280,100) $menu = GuiCtrlCreateMenu("Menu") $terminate = GuiCtrlCreateMenuItem("Exit", $menu) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $terminate terminate() EndSelect WEnd Func terminate() Exit 0 EndFuncRead the Help file, wotk through the tutorials and all will become much clearer! >_< 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...
mdb Posted August 17, 2009 Author Share Posted August 17, 2009 Thanks a bunch for that. I'll check out the GUI Reference in the help file to see if it has more information on what I need. 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