mIRC Homepage
Posted By: HAMM3R Sort List from ini file - 23/11/05 09:25 PM
Here's my code:
Code:
alias autoid.fill {
  did -r $1 1
  if ($2 == Network) { var %i = Nickname }
  if ($2 == Nickname) { var %i = Password }
  if ($2 == Enabled) { var %i = Nickname }
  did -i $1 1 1 headertext $iif($2 == Enabled,Network,$2) $+ $chr(9) $+ %i $+ $chr(9) $+ $iif($2 == Nickname,Network,Password) $+ $chr(9) $+ Enabled
  if ($2 == Network) {
    var %x = 1,%y = 1
    while (%x <= $ini(autoid.ini,0)) {
      if ($ini(autoid.ini,%x) != Autoid-Settings) { 
        while (%y <= $ini(autoid.ini,%x,0)) {
          did -a $1 1 $ini(autoid.ini,%x) $chr(9) $ini(autoid.ini,%x,%y) $chr(9) $gettok($readini(autoid.ini,n,$ini(autoid.ini,%x),$ini(autoid.ini,%x,%y)),1,32) $chr(9) $iif($gettok($readini(autoid.ini,n,$ini(autoid.ini,%x),$ini(autoid.ini,%x,%y)),2,32) == e,Yes,No)
          inc %y
        }
      }
      var %y = 1 | inc %x
    }
  }
  if ($2 == Nickname) {
    var %x = 1,%y = 1
    while (%x <= $ini(autoid.ini,0))  {
      if ($ini(autoid.ini,%x) != Autoid-Settings) {  
        var %z = $ini(autoid.ini,%x,%y)
        while (%y <= $ini(autoid.ini,%x,0)) {
          if ($ini(autoid.ini,%x,%y) == %z) {
            did -a $1 1 $ini(autoid.ini,%x,%y) $chr(9) $gettok($readini(autoid.ini,n,$ini(autoid.ini,%x),$ini(autoid.ini,%x,%y)),1,32) $chr(9) $ini(autoid.ini,%x) $chr(9) $iif($gettok($readini(autoid.ini,n,$ini(autoid.ini,%x),$ini(autoid.ini,%x,%y)),2,32) == e,Yes,No)         
          }
          inc %y
        }
      }
      var %y = 1 | inc %x
    }
  }
  if ($2 == Enabled) {
    var %x = 1,%y = 1
    while (%x <= $ini(autoid.ini,0))  {
      if ($ini(autoid.ini,%x) == Autoid-Settings) { inc %x }
      while (%y <= $ini(autoid.ini,%x,0)) {
        var %z = $readini(autoid.ini,n,$ini(autoid.ini,%x),$ini(autoid.ini,%x,%y))
        if ($gettok(%z,2,32) == e) {
          did -i $1 1 2 $ini(autoid.ini,%x) $chr(9) $ini(autoid.ini,%x,%y) $chr(9) $gettok($readini(autoid.ini,n,$ini(autoid.ini,%x),$ini(autoid.ini,%x,%y)),1,32) $chr(9) $iif($gettok($readini(autoid.ini,n,$ini(autoid.ini,%x),$ini(autoid.ini,%x,%y)),2,32) == e,Yes,No)+
        }
        else {
          did -a $1 $ini(autoid.ini,%x) $chr(9) $ini(autoid.ini,%x,%y) $chr(9) $gettok($readini(autoid.ini,n,$ini(autoid.ini,%x),$ini(autoid.ini,%x,%y)),1,32) $chr(9) $iif($gettok($readini(autoid.ini,n,$ini(autoid.ini,%x),$ini(autoid.ini,%x,%y)),2,32) == e,Yes,No)
        }
        inc %y
      }
      var %y = 1 | inc %x
    }
  }
}

The INI file is set up like this:
[Network]
Nickname=password e
[Autoid-Settings]
Sort=Network

------------------------------

What id like to do, is be able to fill the list in the dailog sorted, based on user prefernce. Im having trouble being able to manupulate the output of the ini file to do what I need. The list is ID 1. And the alias is called in the dialog init event, as well as on sclick of save and edit buttons. The alias is called with:
/autoid.fill <dialog name> <network/nickname/enabled>

The 3 ways to sort is by Network, Nickname, or Enabled/Disabled. By default it sorts by network, which i had no problem with. Enabled is specified by the 'e' after the password in the ini file. If there is no e (there may be a different letter there), so if $gettok(stuff,2,32) != e, then its disabled. But the Nickname will only show 1 nick. i think this is because it takes the 1st nick, and adds the rest if they match that nick. I need it to find all unique nicks. And the enabled only shows 1. Any ideas? I know there are plently of bugs, and ive tried every combination i can think of, but no luck.

Thanks,

HAMM3R
Posted By: HAMM3R Re: Sort List from ini file - 23/11/05 11:47 PM
I found a solution:

http://www.mircscripts.org/showdoc.php?type=code&id=2765

So sorry about the post, i wish I had found that earlier.
© mIRC Discussion Forums