Jump to content
Sign in to follow this  
Info

IniWrite() and IniRead()

Recommended Posts

Info

#include <GUIConstants.au3>

$TheGui = GUICreate("abcdefghijklmnopqrstuvwxyznowiknowmyabc", 388, 100, 258, 181)
$StartButton = GUICtrlCreateButton("Start", 147, 30, 89, 33, 0)
GUICtrlCreateInput ( "save this line", 20, 70, 100, 20)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $StartButton
            Sleep ( 100 )
    EndSelect
WEnd

Now I want it to IniWrite the GUICtrlCreateInput's line as an .ini file,

and in the next time I load the file, the line I wrote in the GUICtrlCreateInput will be there...

Thanks :)

Share this post


Link to post
Share on other sites
Info

I'm newbie at this... ;)

I did search for an answer.

Please just answer my question :)

Share this post


Link to post
Share on other sites
SmOke_N

I'm newbie at this... ;)

I did search for an answer.

Please just answer my question :)

He did answer your question.

In order to read the GUIs control "Input", you'll need to use GUICtrlRead().

So, to put the text in, you'd do something like:

IniWrite("MyIni.ini", "mySection", GUICtrlRead($inputbox), "N/A")

Next time, rather than assume that someone hasn't given you the answer, just because they didn't write the code for you... actually look up what they suggest first :D .


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
Info

I still don't know what to do with the IniRead() =/

Share this post


Link to post
Share on other sites
Richard Robertson

IniWrite("MyIni.ini", "mySection", GUICtrlRead($inputbox), "N/A")

Wouldn't IniWrite("MyIni.ini", "mySection", "inputbox", GUICtrlRead($inputbox)) make a little more sense?

Then you could get it back with GUICtrlSetData($inputbox, IniRead("MyIni.ini", "mySection", "inputbox", "")).

Share this post


Link to post
Share on other sites
SmOke_N

I still don't know what to do with the IniRead() =/

I can tell you a few things ;):)

IniRead is going to be at the beginning of your GUI.

(Think I may have put the params wrong in the other IniWrite example, but this is just a gist post)

$sOldValue = IniRead("MyIni.ini", "mySection", "myinput")

;My GUI Code

guicreate etc...

$inputbox = GUICtrlCreateInput ($sOldValue, 20, 70, 100, 20)

This is really explained in both the IniRead/GUI stuff. If you can't put the rudimentary stuff together, I'd suggest you crawl before you walk and do the AutoIt 1-2-3 Interactive Tutorial

Edited by SmOke_N

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.