mIRC Home    About    Download    Register    News    Help

Print Thread
#230934 25/03/11 09:55 PM
Joined: May 2006
Posts: 15
L
liftman Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: May 2006
Posts: 15
Hi to all!
I've a "little" problem grin i try to explain (sorry for my english...)

inside my file "somefile.ini" i've something like this:

[section]
1=some
2=thing
3=to
4=erase

when i use /remini somefile.ini section 2, the content of file result like this:

[section]
1=some
3=to
4=erase

how i can obtain this result?:

[section]
1=some
2=to
3=erase

thanks in advance!


Ciao!
Joined: Jul 2006
Posts: 4,193
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,193
There's no quick way to get this result, here is a custom alias I made for you :
Code:
alias order_remini {
  var %n = $3
  while ($ini($1,$2,%n) != $null) {
    if ($readini($1,$2,$calc(%n + 1)) != $null) writeini $qt($1) $2 %n $v1
    else remini $qt($1) $2 %n
    inc %n
  }
}
Instead of 'remini file section item', use 'noop $order_remini(file,section,item)'

Last edited by Wims; 25/03/11 10:30 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #230936 25/03/11 10:29 PM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Looks like it may fail if the order is listed as follows:
Quote:
[section]
1=John
4=Sarah
8=Tom

Tomao #230937 25/03/11 10:32 PM
Joined: Jul 2006
Posts: 4,193
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,193
Well, the alias only works with his example : item name must be ordered number with a progression of 1


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
If it helps, the second entry will always be $ini(somefile.ini,section,2).

Wims #230944 26/03/11 11:58 AM
Joined: May 2006
Posts: 15
L
liftman Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: May 2006
Posts: 15
Great! it works fine!

thanks a lot


Ciao!

Link Copied to Clipboard