mIRC Home    About    Download    Register    News    Help

Print Thread
#180431 09/07/07 06: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
I trying to lern $gettok, i grab the line i want to edit with:

$gettok($readini(system\aj\autojoin.ini,%tmp.nwork,channel),0,44)

Thats no problem, how ever if i want to remove the channel #test from the ini file -> [testar1]

Do i need to first grab the info with $gettok, then remove the channel from the line, and last write it back to the ini file again? must be a bether way to do this? someone that care to explain? smile

Added echo since i use the info in a dialog.

Code:
/set %tmp.nwork testar1

alias testar {
  var %lx = $gettok($readini(system\aj\autojoin.ini,%tmp.nwork,channel),0,44)
  var %xl = 1
  while (%lx >= %xl) {
    echo -a $gettok($readini(system\aj\autojoin.ini,%tmp.nwork,channel),%xl,44)
    inc %xl
  }
}

In the ini file.
[testar]
channel=#testar
[testar1]
channel=#testar1,#test,#test2
[testar2]
channel=#testar2


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
sparta #180434 09/07/07 06:52 PM
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
Code:

writeini system\aj\autojoin.ini %tmp.nwork channel $remtok($readini(system\aj\autojoin.ini,%tmp.nwork,channel),#test,1,44)


RoCk #180462 10/07/07 12:37 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Thank you, care to explain a bit how this work too? smile

;-------- Edit

I found a annoying problem that i can't solve with the code.

it will remove the channel if it ends with a , $chr(44) how ever if it's only one channel in the ini file, then it wont end with $chr(44), been trying to solve this, but had no luck, do i need to read from the the file, then check if "," isin the file for the selcted line, then call another alias if the , arent there ? explain please.

Last edited by sparta; 10/07/07 02:08 AM.

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

Link Copied to Clipboard