Ozi Posted November 3, 2007 Posted November 3, 2007 (edited) I'm using an Input box (not dialog) to take in words. I want to have every word I ever typed in the Input box stored in a variable and when the program is about to close it will write it to an INI. How do I do this? Here is what I have so far but it overwrites whatever is in the INI whenever I put in a new word in the input box. $Input = GUICtrlCreateInput("", 365, 25, 110, 20) While 1 $msg = GUIGetMsg() Select Case $msg = $OKButton $savedwords = INIWrite("C:\test.ini", "Section", "Key", GUICtrlRead($Input)) GUICtrlSetData($AddBuddyInput, "") ; just resets the Input box to nothing in it ------------------------------------------------------ Sorry for the title, should be INIWrite... Edited November 3, 2007 by Ozi
Achilles Posted November 3, 2007 Posted November 3, 2007 (edited) Try using a counter so that you're ini data looks like this: [section] 0=Zero 1=This 2=Probably 3=Will 4=Work Use $var = IniReadSecion("C:\test.ini", "Section") Then $var[0][0] will be how many items are already in the list. Consequently you could use something like this to add one more to the list: IniWrite("C:\test.ini", "Section", $var[0][0] + 1, GuiCtrlRead($Input)) Edited November 3, 2007 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
flyingboz Posted November 3, 2007 Posted November 3, 2007 you either need to read the ini key's value in and append to it for your write operation, or create new key /value pairs for each write. Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.
Moderators SmOke_N Posted November 3, 2007 Moderators Posted November 3, 2007 You have to increment the Key or you'll continually overwrite the data. It will be more than just one num... because you'll have to use IniReadSection() to get the next increment number if you haven't already stored it in the var. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Ozi Posted November 4, 2007 Author Posted November 4, 2007 you either need to read the ini key's value in and append to it for your write operation, or create new key /value pairs for each write.How do I append to it when I read it and get new values from the Input. Because doing what Piano Man and Smokin said doesn't work...
Moderators SmOke_N Posted November 4, 2007 Moderators Posted November 4, 2007 How do I append to it when I read it and get new values from the Input. Because doing what Piano Man and Smokin said doesn't work...I'm sure you mean..."It probably does work, I just have a poor implementation of it" ... which in turn, we would ask to see your implementation. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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