oozma Posted February 27, 2009 Share Posted February 27, 2009 Hi, I'm trying to write this GUI to an INI when I click the OK button. Right now it doesn't do anything.. the GUI doesn't even close when I click OK. What gives? I've read through all the help files on iniwrite and don't see anything wrong Thanks for any help anyone can offer. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ;;LABELS $MTrainer = GUICreate("mt", 210, 265, 269, 218) $MM = GUICtrlCreateLabel("Mm:", 16, 56, 70, 17) $HS = GUICtrlCreateLabel("hs:", 32, 80, 50, 17) $R = GUICtrlCreateLabel("r:", 56, 104, 29, 17) $Ok = GUICtrlCreateButton("Ok", 56, 232, 105, 25, 0) $Max = GUICtrlCreateLabel("m:", 8, 200, 135, 17) $Hotkey = GUICtrlCreateLabel("hk", 88, 32, 38, 17) $S = GUICtrlCreateGroup("ss", 8, 8, 161, 169) ;;INPUTS $Mi = GUICtrlCreateInput("", 96, 48, 20, 21) GUICtrlSetLimit(-1, 2) $He = GUICtrlCreateInput("", 96, 72, 20, 21) GUICtrlSetLimit(-1, 2) $Re = GUICtrlCreateInput("", 96, 96, 20, 21) GUICtrlSetLimit(-1, 2) GUICtrlCreateGroup("", -99, -99, 1, 1) $Ma = GUICtrlCreateInput("", 144, 192, 40, 21) GUICtrlSetLimit(-1, 3) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $Ok IniWrite("\config.ini", "Variables", "$hs", GuiCtrlRead($he)) IniWrite("\config.ini", "Variables", "$mi", GuiCtrlRead($mi)) IniWrite("\config.ini", "Variables", "$r", GuiCtrlRead($re)) IniWrite("\config.ini", "Variables", "$mt", GuiCtrlRead($ma)) EndSelect WEnd Link to comment Share on other sites More sharing options...
nitekram Posted February 27, 2009 Share Posted February 27, 2009 Try this: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ;;LABELS $MTrainer = GUICreate("mt", 210, 265, 269, 218) $MM = GUICtrlCreateLabel("Mm:", 16, 56, 70, 17) $HS = GUICtrlCreateLabel("hs:", 32, 80, 50, 17) $R = GUICtrlCreateLabel("r:", 56, 104, 29, 17) $Ok = GUICtrlCreateButton("Ok", 56, 232, 105, 25, 0) $Max = GUICtrlCreateLabel("m:", 8, 200, 135, 17) $Hotkey = GUICtrlCreateLabel("hk", 88, 32, 38, 17) $S = GUICtrlCreateGroup("ss", 8, 8, 161, 169) ;;INPUTS $Mi = GUICtrlCreateInput("", 96, 48, 20, 21) GUICtrlSetLimit(-1, 2) $He = GUICtrlCreateInput("", 96, 72, 20, 21) GUICtrlSetLimit(-1, 2) $Re = GUICtrlCreateInput("", 96, 96, 20, 21) GUICtrlSetLimit(-1, 2) GUICtrlCreateGroup("", -99, -99, 1, 1) $Ma = GUICtrlCreateInput("", 144, 192, 40, 21) GUICtrlSetLimit(-1, 3) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Ok MsgBox('','','') IniWrite("\config.ini", "Variables", "$hs", GuiCtrlRead($he)) IniWrite("\config.ini", "Variables", "$mi", GuiCtrlRead($mi)) IniWrite("\config.ini", "Variables", "$r", GuiCtrlRead($re)) IniWrite("\config.ini", "Variables", "$mt", GuiCtrlRead($ma)) EndSelect WEnd 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
oozma Posted February 27, 2009 Author Share Posted February 27, 2009 (edited) Ty, but I now get a second popup that you entered and the original doesn't close, and no .ini is created or written to I'm hoping for it to save to the ini, close the gui, and continue on with a script that follows. Thanks guys! Really trying to learn this but I'm out of brainpower x_x Edited February 27, 2009 by oozma Link to comment Share on other sites More sharing options...
nitekram Posted February 27, 2009 Share Posted February 27, 2009 Ty, but I now get a second popup that you entered and the original doesn't close, and no .ini is created or written to I'm hoping for it to save to the ini, close the gui, and continue on with a script that follows. Thanks guys! Really trying to learn this but I'm out of brainpower x_xI am not sure I understand - the ini will be in the same folder that you ran your code from. Works for me. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
oozma Posted February 27, 2009 Author Share Posted February 27, 2009 I've tried running as the script and as the compiled version. Both don't give me any .ini file. Even tried to resave to a different directory and search the entire computer for config.ini :/ Link to comment Share on other sites More sharing options...
nitekram Posted February 27, 2009 Share Posted February 27, 2009 I've tried running as the script and as the compiled version. Both don't give me any .ini file. Even tried to resave to a different directory and search the entire computer for config.ini :/expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ;;LABELS $MTrainer = GUICreate("mt", 210, 265, 269, 218) $MM = GUICtrlCreateLabel("Mm:", 16, 56, 70, 17) $HS = GUICtrlCreateLabel("hs:", 32, 80, 50, 17) $R = GUICtrlCreateLabel("r:", 56, 104, 29, 17) $Ok = GUICtrlCreateButton("Ok", 56, 232, 105, 25, 0) $Max = GUICtrlCreateLabel("m:", 8, 200, 135, 17) $Hotkey = GUICtrlCreateLabel("hk", 88, 32, 38, 17) $S = GUICtrlCreateGroup("ss", 8, 8, 161, 169) ;;INPUTS $Mi = GUICtrlCreateInput("", 96, 48, 20, 21) GUICtrlSetLimit(-1, 2) $He = GUICtrlCreateInput("", 96, 72, 20, 21) GUICtrlSetLimit(-1, 2) $Re = GUICtrlCreateInput("", 96, 96, 20, 21) GUICtrlSetLimit(-1, 2) GUICtrlCreateGroup("", -99, -99, 1, 1) $Ma = GUICtrlCreateInput("", 144, 192, 40, 21) GUICtrlSetLimit(-1, 3) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Ok MsgBox('', 'WRITING INI FILE', '') IniWrite("config.ini", "Variables", "$hs", GUICtrlRead($He)) IniWrite("config.ini", "Variables", "$mi", GUICtrlRead($Mi)) IniWrite("config.ini", "Variables", "$r", GUICtrlRead($Re)) IniWrite("config.ini", "Variables", "$mt", GUICtrlRead($Ma)) $file = FileOpen("config.ini", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit Else MsgBox('','FILE EXIST', 'config.ini') EndIf FileClose($file) EndSelect WEnd 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
oozma Posted February 27, 2009 Author Share Posted February 27, 2009 Thank you that did it Actually just tried removing the \ before refreshing this page. TY very much! Only thing left is the GUI closing after clicking OK. doesn't seem to close Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 28, 2009 Share Posted February 28, 2009 Thank you that did it Actually just tried removing the \ before refreshing this page. TY very much! Only thing left is the GUI closing after clicking OK. doesn't seem to close Have you tried telling it to close? AutoIt is no mindreader you know .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
GEOSoft Posted February 28, 2009 Share Posted February 28, 2009 AutoIt is no mindreader you know Say what? No wonder I've been having problems. I thought that the "auto" in AutoIt meant automatic and now you're telling me that it won't automatically do something. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
oozma Posted February 28, 2009 Author Share Posted February 28, 2009 Thanks Admiral, I thought the GUI creator would put that command in there by itself, so I didnt think it needed one. All good to go. Ty guys! 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