Buffo Posted October 21, 2006 Share Posted October 21, 2006 (edited) Hi! In the last days it seems to me that AutoIt3 will not work properly any more on my machine. This simple script does not work for me. Neither the "Start" nor the "Quit"-function will be called. Nearly every day I use the GUI functions of AutoIt and it works well but this script does not work and I don't see any mistake. expandcollapse popup#NoTrayIcon #include <GuiConstants.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Func OnAutoItStart() ShowGUI() EndFunc Func ShowGUI() Local $gui Local $inp_OldFile, $inp_NewFile, $inp_DiffFile Local $btn_Start, $btn_Quit $gui = GUICreate("Test-GUI", 396, 140) GUICtrlCreateLabel("Source", 12, 16, 80, 12) $inp_OldFile = GUICtrlCreateInput("", 80, 12, 280, 20) $inp_OldFile = GUICtrlCreateButton("...", 366, 12, 20, 20) GUICtrlCreateLabel("Target", 12, 42, 80, 12) $inp_NewFile = GUICtrlCreateInput("", 80, 40, 280, 20) $btn_NewFile = GUICtrlCreateButton("...", 366, 40, 20, 20) GUICtrlCreateLabel("Folder", 12, 68, 80, 12) $inp_DiffFile = GUICtrlCreateInput("", 80, 66, 280, 20) $btn_DiffFile = GUICtrlCreateButton("...", 366, 66, 20, 20) GUICtrlCreateGroup ("" , -4, 92, 410, 50) $btn_Start = GUICtrlCreateButton ("&Start", 80, 108, 100, 24) $btn_Quit = GUICtrlCreateButton ("&Quit", 184, 108, 100, 24) GUICtrlSetOnEvent($btn_Quit, "Quit") GUICtrlSetOnEvent($btn_Start, "Start") GuiSetState(@SW_SHOW) While 1 Sleep(10) WEnd EndFunc Func Quit() MsgBox(32, "Quit", "") Exit EndFunc Func Start() MsgBox(32, "Start", "") EndFunc Can you see any mistake and help me? Regards, Buffo Edited October 21, 2006 by Buffo Link to comment Share on other sites More sharing options...
GaryFrost Posted October 21, 2006 Share Posted October 21, 2006 (edited) expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) ShowGUI() Func ShowGUI() Local $gui Local $inp_OldFile, $inp_NewFile, $inp_DiffFile Local $btn_Start, $btn_Quit, $btn_NewFile, $btn_DiffFile $gui = GUICreate("Test-GUI", 396, 140) GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") GUICtrlCreateLabel("Source", 12, 16, 80, 12) $inp_OldFile = GUICtrlCreateInput("", 80, 12, 280, 20) $inp_OldFile = GUICtrlCreateButton("...", 366, 12, 20, 20) GUICtrlCreateLabel("Target", 12, 42, 80, 12) $inp_NewFile = GUICtrlCreateInput("", 80, 40, 280, 20) $btn_NewFile = GUICtrlCreateButton("...", 366, 40, 20, 20) GUICtrlCreateLabel("Folder", 12, 68, 80, 12) $inp_DiffFile = GUICtrlCreateInput("", 80, 66, 280, 20) $btn_DiffFile = GUICtrlCreateButton("...", 366, 66, 20, 20) GUICtrlCreateGroup("", -4, 92, 410, 50) $btn_Start = GUICtrlCreateButton("&Start", 80, 108, 100, 24) $btn_Quit = GUICtrlCreateButton("&Quit", 184, 108, 100, 24) GUICtrlSetOnEvent($btn_Quit, "Quit") GUICtrlSetOnEvent($btn_Start, "Start") GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd EndFunc ;==>ShowGUI Func Quit() MsgBox(32, "Quit", "") Exit EndFunc ;==>Quit Func Start() MsgBox(32, "Start", "") EndFunc ;==>Start Edited October 21, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Buffo Posted October 21, 2006 Author Share Posted October 21, 2006 I don't understand!? It works if I omit the Func OnAutoItStart()? Why is that so? I use OnAutoItStart() because I don't like other code than declarations of global vars and constants and the header of the script out of a function. Can you explain? This function should only call the other function when the script starts. Ah... now I understand... ...while writing this I recognized my mistake: The function will be called BEFORE the Opt("GUIOnEventmode", 1) is passed. I have to go to bed because my whole concentration seems to be lost Regards, Buffo Link to comment Share on other sites More sharing options...
JSThePatriot Posted October 21, 2006 Share Posted October 21, 2006 Yea that is where I was heading before I saw your post. Too many functions... lol JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) 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