mIRC Home    About    Download    Register    News    Help

Print Thread
E
ELY_M
ELY_M
E
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






Joined: Jan 2003
Posts: 2,973
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Jan 2003
Posts: 2,973
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.

E
ELY_M
ELY_M
E
look at mIRC ini files

they have

n1=
n2=
n3=
n4=

khaled is coding God laugh


Joined: Dec 2002
Posts: 787
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 787
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.

E
ELY_M
ELY_M
E
Thanks for the tip smile

But

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




Joined: Feb 2004
Posts: 34
D
Babel fish
Offline
Babel fish
D
Joined: Feb 2004
Posts: 34
So let me get this straight, you havent actually used mIRC to code this clock of yours? *bangs head against wall*

Joined: Jul 2003
Posts: 733
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jul 2003
Posts: 733
i could have told you that. look at the cornerof his screenshot.. thats a file used for C programming

Joined: Dec 2002
Posts: 787
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 787
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.

Joined: Aug 2004
Posts: 142
N
Vogon poet
Offline
Vogon poet
N
Joined: Aug 2004
Posts: 142
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!

Joined: Jan 2003
Posts: 247
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Jan 2003
Posts: 247
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


Link Copied to Clipboard