Newb Posted April 11, 2012 Share Posted April 11, 2012 As I said I know what's the error and how to solve it, just reporting it to take a review before submitting it as a bug (because maybe it's not). Seems more parser don't like it, and i thought you MVP's wanted to know about it Here's the code GUICreate("Form1", 600, 482, 192, 124) $Button1 = GUICtrlCreateButton("Numeri", 48, 32, 169, 65) $Button2 = GUICtrlCreateButton("Lettere", 264, 32, 193, 65) $Label1 = GUICtrlCreateLabel("", 16, 128, 572, 348) GUISetState() Opt("GUIOnEventMode",1) GUISetOnEvent(-3,_Exit()) While 1 Sleep(100) WEnd Func _Exit() Exit EndFunc Problem is in Opt("GUIOnEventMode",1) GUISetOnEvent(-3,_Exit()) While 1 Sleep(100) WEnd Which should be Opt("GUIOnEventMode",1) GUISetOnEvent(-3,"_Exit") While 1 Sleep(100) WEnd to run properly. Autoit doesn't show the _Exit() without " " as an error and even the while loop doesn't run properly. Don't know the mechanism behind this, but maybe you wanted to be warn about it. Peace. I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it. Link to comment Share on other sites More sharing options...
hannes08 Posted April 11, 2012 Share Posted April 11, 2012 (edited) I guess this is how it should be an no bug at all. Look at the example: GUICreate("Form1", 600, 482, 192, 124) $Button1 = GUICtrlCreateButton("Numeri", 48, 32, 169, 65) $Button2 = GUICtrlCreateButton("Lettere", 264, 32, 193, 65) $Label1 = GUICtrlCreateLabel("", 16, 128, 572, 348) GUISetState() Opt("GUIOnEventMode",1) GUISetOnEvent(-3,_Exit()) While 1 Sleep(100) WEnd Func _Exit() ConsoleWrite("Called ""Exit"" :-) ") Return "_myExit" EndFunc Func _myExit() Exit 77 EndFunc The function call in "GuiSetOnEvent" Just calls the "_Exit" Function. Whatever you defined happens. In your case it just exited the script. Edited April 11, 2012 by hannes08 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
BrewManNH Posted April 11, 2012 Share Posted April 11, 2012 Try this snippet out, it shows what it is that is happening. GUICreate("Form1", 600, 482, 192, 124) $Button1 = GUICtrlCreateButton("Numeri", 48, 32, 169, 65) $Button2 = GUICtrlCreateButton("Lettere", 264, 32, 193, 65) $Label1 = GUICtrlCreateLabel("", 16, 128, 572, 348) GUISetState() Opt("GUIOnEventMode", 1) GUISetOnEvent(-3, _NoExit()) While 1 Sleep(100) WEnd Func _Exit() Exit EndFunc ;==>_Exit Func _NoExit() Return "_Exit" EndFunc ;==>_NoExit When you write it like the way you did, it calls the function _Exit looking for something to be returned. Because it immediately exits, there's no return from it. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator 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