Newb 5 Posted August 9, 2011 Hi all. I'm on win 7. I'm trying to make a simple database of notes that Input that will allow me to read them when I'll need them. It's still at the start but I'm already having problems. So this program looks for a file, if it finds it opens it, otherwise it create it. Look at the source code, I'm on win 7 but when I run this and press the button, nothing happens. Already tried #RequireAdmin expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #Include <File.au3> Opt("GuiOnEventMode",1) GUICreate("Second Mind", 612, 550, 247, 162) GUISetOnEvent(-3,"_Exit") GUICtrlCreateTab(8, 8, 593, 529) $TabSheet1 = GUICtrlCreateTabItem("Aggiungi Appunto") GUICtrlCreateLabel("Titolo:", 16, 48, 33, 17) GUICtrlCreateLabel("Appunto:", 16, 104, 47, 17) $TitoloAdd = GUICtrlCreateInput("Input1", 16, 72, 449, 21) $AppuntoAdd = GUICtrlCreateInput("Input2", 16, 128, 449, 21) $TitoloAddButt = GUICtrlCreateButton("Aggiungi appunto", 480, 72, 105, 25) GUISetOnEvent(-1,"_SaveFile") $AppuntoAddButt = GUICtrlCreateButton("Informazioni", 480, 128, 105, 25) $TabSheet2 = GUICtrlCreateTabItem("Consulta Appunto") GUICtrlCreateLabel("Titolo:", 16, 160, 33, 17) GUICtrlCreateLabel("Appunto:", 16, 216, 47, 17) $TitoloRead = GUICtrlCreateInput("Input2", 16, 240, 569, 21) $AppuntoRead = GUICtrlCreateInput("Input1", 16, 184, 561, 21) $RicercaButt = GUICtrlCreateButton("Cerca", 480, 80, 105, 25) $RicercaEdit = GUICtrlCreateInput("Ricerca", 16, 80, 417, 21) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func _Exit() Exit EndFunc Func _SaveFile() If Not FileExists(@DesktopDir&"/Appunto.sdm") Then _FileCreate(@DesktopDir&"/Appunto.sdm") MsgBox(0,"ok","file creato") Else FileOpen(@DesktopDir&"/Appunto.sdm") MsgBox(0,"ok","file trovato") GuiCtrlRead($TitoloAdd) EndIf EndFunc Thanks 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. Share this post Link to post Share on other sites
JohnOne 1,603 Posted August 9, 2011 GUISetOnEvent(-1,"_SaveFile") Tyr GUICtrlSetOnEvent(-1,"_SaveFile") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Share this post Link to post Share on other sites
BrewManNH 1,305 Posted August 9, 2011 Change this: $TitoloAddButt = GUICtrlCreateButton("Aggiungi appunto", 480, 72, 105, 25) GUISetOnEvent(-1,"_SaveFile") ;<<<<<<<<<<<<<<<<<<<<< Change this line To this: $TitoloAddButt = GUICtrlCreateButton("Aggiungi appunto", 480, 72, 105, 25) GUICTRLSetOnEvent(-1,"_SaveFile") ; <<<<<<<<<<<<<<<<<< To this You're trying to fire an event on the GUI and not on the control the way it was originally written. 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 Share this post Link to post Share on other sites
Newb 5 Posted August 9, 2011 Thanks everyone. 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. Share this post Link to post Share on other sites