mIRC Homepage
I know mIRC has this cool scripting thing into the .ini files.
I would like some help from mIRC coders here.

I am working on this little clock program and I added notepad to it.
I wanted it to save notepad text to its one ini file

[BOX1]
Title=test1 remeber me
Hour=10
Minutes=1
AM_PM=PM
[BOX2]
Title=test2
Hour=3
Minutes=4
AM_PM=PM
[BOX3]
Title=test3
Hour=5
Minutes=6
AM_PM=PM
[BOX4]
Title=test4
Hour=0
Minutes=0
AM_PM=AM
[BOX5]
Title=test5
Hour=0
Minutes=0
AM_PM=AM
[BOX6]
Title=test6
Hour=0
Minutes=0
AM_PM=AM
[NOTEPAD]


note=dfsdfasdjf
fksjflasd;f
df;alsdf;ladsf

MY COOL NOTE PAD !!!!!!



when you open it again after you close it

you only see dfsdfasdjf


I know I need to add

note1=
note2=
note3=
note4=

here is my screenshot





Perhaps you need to look up the syntax for an ini file. INI files are designed to only need one line per item, be that a heading or entry. This is not a limitation of mIRC either, but of windows itself. Maybe you need to consider using an alternate save method if you wish to use multiple lines.

This post is not meant to be sarcastic or rude, just realistic. INI files aren't designed to save in that manner. If you need otherwise, use an alternate method.
look at mIRC ini files

they have

n1=
n2=
n3=
n4=

khaled is coding God laugh

They dont "have" n1/n2/n3 that just happens to be the format mIRC uses, they arent required to have Nth anything, however, if you use the following type of "edit box".

edit "", 5, 10 25 90 70, multi, return, vsbar
(Those options)

The following will OUTPUT all of the data in the edit box.

var %i = 1
while ($did([color:red]test
,5).lines > %i) {
echo $+(n,%i,=,$did(test,5,%i))
inc %i
}
[/color]
Will ECHO all of the lines in your editbox, in the format;

n1=line1
n2=line2
n3=line3

Note that, TEST is the dialog name and 5 is the editbox ID, change them accordingly.

To, input the data from the ini file into the dialog, use.

var %i = 1
while ($ini([color:red]test.ini
,testing,0) >= %i) {
echo -s $readini(test.ini,testing,$ini(test.ini,testing,%i)))
inc %i
}
[/color]
Where in the above, test.ini is the INI FILENAME, testing is the "section", i.e. [test]

Hope this helps.

Eamonn.
Thanks for the tip smile

But

my program is in ms vc++ MFC
I program in MFC and c++ in ms vc++ 6.0



So let me get this straight, you havent actually used mIRC to code this clock of yours? *bangs head against wall*
i could have told you that. look at the cornerof his screenshot.. thats a file used for C programming
I'm guessing the confusion is the fact this is a mIRC related forum and has NOTHING to do with C/C++, but I guess we shouldnt always rely on the user to know what the forum is for.

Also, google.com search for a C/C++ INI File procedure.

Eamonn.
I just have to say, yuck. INI files are slow and IMHO no good script has them. I know someone is going to point that mIRC uses INI files. But it doesn't. mIRC doesn't open the file, read it, then close it. It loads the file into the buffer, thats why there is /saveini, to reload the INI file into the buffer. But anyways, hashtables all the way!
maybe you can use a char recognition partern as \n and switch it back to $crlf when you extract it from the ini and the reverse process to write down your multiline text to the ini file.

item=arf\narf -> arf $+ $crlf $+ arf

anyways, just a suggestion, you can use anything for \n as replacement string
© mIRC Discussion Forums