Neeeewbie Posted August 19, 2017 Share Posted August 19, 2017 I'm trying to make a super basic GUI where I can type in a Name (lets say User123) and some text (like has my in game super spiffy sword) and click update <- where it would create a ini that I can load latter and edit/update as needed. I'm having issues with it creating the ini. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ;GUI start $Form1 = GUICreate("Form1", 518, 330, 200, 121) $Button1 = GUICtrlCreateButton("Search", 30, 264, 105, 41, $WS_GROUP) ;$Button2 = GUICtrlCreateButton("Edit", 140, 264, 105, 41, $WS_GROUP); idk why I made this button $Button3 = GUICtrlCreateButton("Update", 250, 264, 105, 41, $WS_GROUP) $Button4 = GUICtrlCreateButton("Exit", 375, 264, 105, 41, $WS_GROUP) $Edit1 = GUICtrlCreateEdit("event log here", 40, 64, 429, 161) GUICtrlSetData(-1, "Event log here") $Input1 = GUICtrlCreateInput("UserNameHere", 72, 24, 129, 21) $Username = GUICtrlCreateLabel("UserName", 16, 24, 52, 17) GUISetState(@SW_SHOW) ;GUI end While 1 Sleep(10) $msg = GUIGetMsg() Select Case $msg = $Button1 ConsoleWrite ( "Search was pushed" ) ; Case $msg = $Button2 ;ConsoleWrite ( "Edit was pushed" ) Case $msg = $Button3 ConsoleWrite ( "Update was pushed" ) $Input1 = $Input1 IniWrite(@ScriptDir, $Input1, "History Log", $Edit1) ConsoleWrite ($Input1) ConsoleWrite ($Edit1) Case $msg = $Button4 ConsoleWrite ( "Exit was pushed" ) Exit EndSelect WEnd Exit ^it doesn't seem to make the ini file. Can someone point out my mistake? Probably something simple I'm just not seeing. Link to comment Share on other sites More sharing options...
Trong Posted August 19, 2017 Share Posted August 19, 2017 From: IniWrite(@ScriptDir, $Input1, "History Log", $Edit1) To: IniWrite(@ScriptDir & "\MyFile.ini", GUICtrlRead($Input1), "History Log", GUICtrlRead($Edit1)) ________________________________________________________________________ IniWrite Writes a value to a standard format .ini file. IniWrite ( "filename", "section", "key", "value" ) Parameters filename The filename of the .ini file. section The section name in the .ini file. key The key name in the .ini file. value The value to write/change. Return Value Success: 1. Failure: 0 if file is read-only. Remarks A standard ini file looks like: [SectionName] Key=Value Neeeewbie 1 Regards, Link to comment Share on other sites More sharing options...
Neeeewbie Posted August 19, 2017 Author Share Posted August 19, 2017 dank you. Link to comment Share on other sites More sharing options...
jguinch Posted August 19, 2017 Share Posted August 19, 2017 If you write the content of an edit like you want to do, it's possible it contains a carriage return, not a good idea for a string used with IniWrite IMHO Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Neeeewbie Posted August 19, 2017 Author Share Posted August 19, 2017 (edited) New issue. It wrights and reads fine but when I click the edit text box (after searching/loading one) It like to erase/go back to the default "event log here". expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ;GUI start $Form1 = GUICreate("Form1", 518, 330, 200, 121) $Button1 = GUICtrlCreateButton("Search", 30, 264, 105, 41, $WS_GROUP) ;$Button2 = GUICtrlCreateButton("Edit", 140, 264, 105, 41, $WS_GROUP); idk why I made this button $Button3 = GUICtrlCreateButton("Update", 250, 264, 105, 41, $WS_GROUP) $Button4 = GUICtrlCreateButton("Exit", 375, 264, 105, 41, $WS_GROUP) $Edit1 = GUICtrlCreateEdit("event log here", 40, 64, 429, 161) GUICtrlSetData(-1, "Event log here") $Input1 = GUICtrlCreateInput("UserNameHere", 72, 24, 129, 21) $Username = GUICtrlCreateLabel("UserName", 16, 24, 52, 17) GUISetState(@SW_SHOW) ;GUI end While 1 Sleep(10) $msg = GUIGetMsg() Select Case $msg = $Button1 ConsoleWrite ( "Search was pushed" ) $sRead = IniRead(@ScriptDir & "\MyFile.ini", GUICtrlRead($Input1), "History Log", GUICtrlRead($Edit1)) $Edit1 = GUICtrlCreateEdit($sRead, 40, 64, 429, 161) ; Case $msg = $Button2 ;ConsoleWrite ( "Edit was pushed" ) Case $msg = $Button3 ConsoleWrite ( "Update was pushed" ) IniWrite(@ScriptDir & "\MyFile.ini", GUICtrlRead($Input1), "History Log", GUICtrlRead($Edit1)) Case $msg = $Button4 ConsoleWrite ( "Exit was pushed" ) Exit EndSelect WEnd Exit Edited August 19, 2017 by Neeeewbie 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