Jump to content

IniWrite() and IniRead()


Recommended Posts

#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 :)

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...