mIRC Home    About    Download    Register    News    Help

Print Thread
khaled: can you help me? save/write multi lines #95790 27/08/04 07:26 AM
Joined: Dec 2003
Posts: 21
E
ELY_M Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Dec 2003
Posts: 21
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







ELY M.
Re: khaled: can you help me? save/write multi lines #95791 27/08/04 08:03 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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.


-KingTomato
Re: khaled: can you help me? save/write multi line #95792 27/08/04 05:48 PM
Joined: Dec 2003
Posts: 21
E
ELY_M Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Dec 2003
Posts: 21
look at mIRC ini files

they have

n1=
n2=
n3=
n4=

khaled is coding God laugh



ELY M.
Re: khaled: can you help me? save/write multi line #95793 27/08/04 06:27 PM
Joined: Dec 2002
Posts: 788
C
Coolkill Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
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.

Re: khaled: can you help me? save/write multi line #95794 28/08/04 03:09 AM
Joined: Dec 2003
Posts: 21
E
ELY_M Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Dec 2003
Posts: 21
Thanks for the tip smile

But

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





ELY M.
Re: khaled: can you help me? save/write multi line #95795 31/08/04 12:06 PM
Joined: Feb 2004
Posts: 50
D
Ddan Offline
Babel fish
Offline
Babel fish
D
Joined: Feb 2004
Posts: 50
So let me get this straight, you havent actually used mIRC to code this clock of yours? *bangs head against wall*

Re: khaled: can you help me? save/write multi line #95796 31/08/04 06:52 PM
Joined: Jul 2003
Posts: 742
MTec89 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jul 2003
Posts: 742
i could have told you that. look at the cornerof his screenshot.. thats a file used for C programming


http://MTec89Net.com
irc.freenode.net #MTec89Net
Re: khaled: can you help me? save/write multi line #95797 31/08/04 07:03 PM
Joined: Dec 2002
Posts: 788
C
Coolkill Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
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.

Re: khaled: can you help me? save/write multi line #95798 01/09/04 03:13 AM
Joined: Aug 2004
Posts: 147
N
nalAAlan Offline
Vogon poet
Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
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!

Re: khaled: can you help me? save/write multi line #95799 17/09/04 01:34 PM
Joined: Jan 2003
Posts: 249
C
ClickHeRe Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Jan 2003
Posts: 249
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