mIRC Home    About    Download    Register    News    Help

Print Thread
readini #146386 04/04/06 12:00 AM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
how can i $readini and put whole list (that is in ini under some section) in notice or msg chan ?

coz i have

blacklist.ini
[blackmark]

*!*addres1
*!*addres2

etc...
crap is that i dont want to define item (1)
but to read ALL items

is that even possible ?

Last edited by raZOR; 04/04/06 12:02 AM.

IceCapped
Re: readini #146387 04/04/06 12:31 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
look at using $ini
some test
Code:
alias getblackmark {
var %itemcount $ini(blacklist.ini, blackmark,0)
var %i = 1
while (%i <= %itemcount) {
echo -a $ini(blacklist.ini, blackmark,%i)
var %getitem = $ini(blacklist.ini, blackmark,%i)
echo -a $READINI(blacklist,blackmark,%getitem,%i)
inc %i
}
}


Comment: I didnt test this

Re: readini #146388 04/04/06 12:39 AM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
it reads 1st line and get error for this line:
echo -a $READINI(blacklist,blackmark,%getitem,%i)


IceCapped
Re: readini #146389 04/04/06 12:41 AM
Joined: Feb 2005
Posts: 681
M
mIRCManiac Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
Code:
alias iniread {
  ; Syntax: /iniread <#chan> <section> <path\file>
  if ($1 !ischan) echo -ac info * You're not on $+($1,.)
  elseif (!$isfile($3-)) echo -ac info * File doesn't exist. $+($chr(40),$3-,$chr(41))
  elseif (!$ini($3-,$2)) echo -ac info * Section $+(,$2,) does not exist. $+($chr(40),$3-,$chr(41))
  else {
    var %i = 1
    while ($ini($3-,$2,%i) != $null) {
      .timer 1 %i msg $1 $readini($3-,$2,$v1)
      inc %i
    }
  }
}


alias iniread {
; Syntax: /iniread <#chan> <section> <path\file>
if ($1 !ischan) echo -ac info * You're not on $+($1,.)
elseif (!$isfile($3-)) echo -ac info * File doesn't exist. $+($chr(40),$3-,$chr(41))
elseif (!$ini($3-,$2)) echo -ac info * Section $+(,$2,) does not exist. $+($chr(40),$3-,$chr(41))
else {
var %i = 1
while ($ini($3-,$2,%i) != $null) {
.timer 1 %i msg $1 $readini($3-,$2,$v1)
inc %i
}
}
}

Re: readini #146390 04/04/06 12:49 AM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
ehm, it says file doesnt exist altho it does :P

* File doesn't exist. ()

i tried

//iniread blackmark $scriptdir\blacklist.ini
and
//iniread blackmark blacklist.ini

Last edited by raZOR; 04/04/06 12:50 AM.

IceCapped
Re: readini #146391 04/04/06 12:50 AM
Joined: Feb 2005
Posts: 681
M
mIRCManiac Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
If it's not in the mIRC directory you need to supply the path.

Try: /iniread <#chan> blackmark blacklist.ini

Supply the path if it's not in your mIRC folder.

Last edited by mIRCManiac; 04/04/06 12:52 AM.
Re: readini #146392 04/04/06 12:51 AM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
edited =)

i think $scriptdir should do altho file is in main mirc folder


IceCapped
Re: readini #146393 04/04/06 12:53 AM
Joined: Feb 2005
Posts: 681
M
mIRCManiac Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
Or that too. grin

Re: readini #146394 04/04/06 01:00 AM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
no hard feelings
i removed #chan thigs coz i want notice smile
but for start i only gave ECHO
Code:
 
alias iniread {
  ; Syntax: /iniread &lt;section&gt; &lt;path\file&gt;
  if (!$isfile($3-)) echo -ac info * File doesn't exist. $+($chr(40),$3-,$chr(41))
  elseif (!$ini($3-,$2)) echo -ac info * Section $+(,$2,) does not exist. $+($chr(40),$3-,$chr(41))
  else
  var %i = 1
  while ($ini($3-,$2,%i) != $null) {
    .echo -a $readini($3-,$2,$v1)
    inc %i
  }
}
 


and as stated above it wont work


IceCapped
Re: readini #146395 04/04/06 01:05 AM
Joined: Feb 2005
Posts: 681
M
mIRCManiac Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
Quote:
no hard feelings


Hey that's quite alright, do whatever you want with it smile

Code:
alias iniread {
  ; Syntax: /iniread &lt;section&gt; &lt;path\file&gt;
  if (!$isfile($2-)) echo -ac info * File doesn't exist. $+($chr(40),$2-,$chr(41))
  elseif (!$ini($[color:red]2[/color]-,$1)) echo -ac info * Section $+(,$1,) does not exist. $+($chr(40),$2-,$chr(41))
  else {
    var %i = 1
    while ($ini($2-,$1,%i) != $null) {
      echo -a $readini($2-,$1,$v1)
      inc %i
    }
  }
}


alias iniread {
; Syntax: /iniread <section> <path\file>
if (!$isfile($2-)) echo -ac info * File doesn't exist. $+($chr(40),$2-,$chr(41))
elseif (!$ini($2-,$1)) echo -ac info * Section $+(,$1,) does not exist. $+($chr(40),$2-,$chr(41))
else {
var %i = 1
while ($ini($2-,$1,%i) != $null) {
echo -a $readini($2-,$1,$v1)
inc %i
}
}
}

~ Edit ~

Sorry, change the part in red.

Last edited by mIRCManiac; 04/04/06 01:10 AM.
Re: readini #146396 04/04/06 01:08 AM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
* Section blackmark does not exist. (D:\mirc\blacklist.ini)

and yet it does exist :P

proof:

[blackmark]

*!*@im.so.[censored].pro.vg=1
*!*@c-2d7c70d5.03-86-6b6c6d1.cust.bredbandsbolaget.se=1


Last edited by raZOR; 04/04/06 01:09 AM.

IceCapped
Re: readini #146397 04/04/06 01:17 AM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
now it only reads

1
1

where ini is:

[blackmark]

*!*@im.so.[censored].pro.vg=1
*!*@c-2d7c70d5.03-86-6b6c6d1.cust.bredbandsbolaget.se=1


IceCapped
Re: readini #146398 04/04/06 01:35 AM
Joined: Feb 2005
Posts: 681
M
mIRCManiac Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
argh

Remove the $readini

alias iniread {
; Syntax: /iniread <section> <path\file>
if (!$isfile($2-)) echo -ac info * File doesn't exist. $+($chr(40),$2-,$chr(41))
elseif (!$ini($2-,$1)) echo -ac info * Section $+(,$1,) does not exist. $+($chr(40),$2-,$chr(41))
else {
var %i = 1
while ($ini($2-,$1,%i) != $null) {
echo -a $v1
inc %i
}
}
}

/exit

Last edited by mIRCManiac; 04/04/06 01:37 AM.
Re: readini #146399 04/04/06 10:20 AM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
woohooo
it works !!!!

thank you thank you ! laugh

-> sorry for long time reply (i had to sleep) :P


IceCapped
Re: readini #146400 04/04/06 06:50 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Quote:
it reads 1st line and get error for this line:
echo -a $READINI(blacklist,blackmark,%getitem,%i)

alias getblackmark {
var %itemcount $ini(blacklist.ini, blackmark,0)
var %i = 1
while (%i <= %itemcount) {
echo -a $ini(blacklist.ini, blackmark,%i)
var %getitem = $ini(blacklist.ini, blackmark,%i)
echo -a $READINI(blacklist,blackmark,%getitem)
inc %i
}
}

sorry, Im a bit rusty but i think that will work

Re: readini #146401 04/04/06 07:01 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Quote:
now it only reads
1
1
where ini is:
[blackmark]
*!*@im.so.[censored].pro.vg=1
*!*@c-2d7c70d5.03-86-6b6c6d1.cust.bredbandsbolaget.se=1


you can use the $ini to help you write the ini so the address is the data, rather than the item
you just need to have a
var %itemcount $ini(blacklist.ini,blackmark,0) + $ctime

so when you write it
writeini blacklist.ini blackmark %itemcount (address info)
so in the ini it would look like
[blackmark]
11144177152=nick!user@host
21144177377=nick!user@host2

so on