Sign in to follow this  
Followers 0
Ozi

INIRead

7 posts in this topic

#1 ·  Posted (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 by Ozi

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Ok, thanks for all the advice. It works <_<

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0