mIRC Home    About    Download    Register    News    Help

Print Thread
ini file problem #224987 23/08/10 01:52 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I trying to return how many sections i have in a ini file..

example
Code:
[test1]
bla=1
info=1

[test2]
bla=2
info=2

[test3]
bla=3
info=3

This should return 3, how can i do that with $readini ? been trying a while but with no luck.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: ini file problem [Re: sparta] #224989 23/08/10 02:35 PM
Joined: Dec 2002
Posts: 2,024
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,024

I don't think there is a way to do that with $readini but try $ini instead.

Re: ini file problem [Re: sparta] #224991 23/08/10 02:57 PM
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline
Fjord artisan
Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
If the file and sections will be in the format that you posted, I have just worked out a more efficient way to do it.

Not using $readini though.

Code:
alias count_sections {
  filter -cffgx $1 sections.tmp =|]
  .remove sections.tmp
  $iif($isid,return,echo -a) $calc($filtered + 1)
}


/usage /count_sections filename.ini

Last edited by HaleyJ; 23/08/10 03:02 PM.

Newbie
Re: ini file problem [Re: HaleyJ] #224993 23/08/10 03:11 PM
Joined: Jul 2006
Posts: 3,764
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,764
As said/suggested, $ini(file,0) return the number of section in the file..


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: ini file problem [Re: Wims] #224996 23/08/10 05:15 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yeah, there's no need for anything fancy. $ini(file.txt,0) gives you the number of sections.


Invision Support
#Invision on irc.irchighway.net
Re: ini file problem [Re: Wims] #224999 23/08/10 05:36 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
tested it, and it worked as i wanted it to smile thnx.. smile


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: ini file problem [Re: sparta] #225002 23/08/10 06:31 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
never mind.

Last edited by sparta; 23/08/10 06:46 PM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }