mIRC Homepage
Posted By: sparta ini file problem - 23/08/10 01:52 PM
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.
Posted By: RoCk Re: ini file problem - 23/08/10 02:35 PM

I don't think there is a way to do that with $readini but try $ini instead.
Posted By: HaleyJ Re: ini file problem - 23/08/10 02:57 PM
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
Posted By: Wims Re: ini file problem - 23/08/10 03:11 PM
As said/suggested, $ini(file,0) return the number of section in the file..
Posted By: Riamus2 Re: ini file problem - 23/08/10 05:15 PM
Yeah, there's no need for anything fancy. $ini(file.txt,0) gives you the number of sections.
Posted By: sparta Re: ini file problem - 23/08/10 05:36 PM
tested it, and it worked as i wanted it to smile thnx.. smile
Posted By: sparta Re: ini file problem - 23/08/10 06:31 PM
never mind.
© mIRC Discussion Forums