mIRC Homepage
Posted By: Knappen Help with searching a file - 11/09/03 04:36 PM
Hi!

I have this code that is supose do work kinda like the same way when you press the J button in WinAmp... It`s suppose to search the file for matches to the input word..

Code:
 

dialog søk {
  title "Search
  size -1 -1 130 150
  option dbu

  edit "", 1, 11 10 90 11
  button "&Search", 2, 105 10 20 11, disable default

  list 3, 10 25 115 110

  button "&OK", 4, 70 135 25 13, ok
  button "&Cancel", 5, 40 135 25 13, cancel
}

on *:dialog:search:edit:1:{
  if ($did(1) != $null) { did -e $dname 2 }
  else { did -b $dname 2 }
}

on *:dialog:search:sclick:*:{
  if ($did == 2) {
    var %lines = $lines(mp3list.lis)
    var %num = 1
    var %match
    while (%lines >= %num) {
      $read(mp3list.lis, tw, * $+ $did(1) $+ *, %num)
      %match = $read(mp3list.lis, $readn)
      did -i $dname 3 %num %match
      inc %num
    }
  }
}

 


What this doeas at the moment is that it searches the mp3list.lis file and returns the first match many times and then all the other matches.. Whats wrong? Can anyoe help me?

Thanks! smile
Posted By: LocutusofBorg Re: Help with searching a file - 11/09/03 05:54 PM
personally I would open a window and /filter -fw filename windowname *keyword*
Posted By: cybah Re: Help with searching a file - 11/09/03 08:36 PM
He is using a dialog as output so -o would be handy here,also because he searches something,an alphabetic order would be handy (-t).


Use this instead:
Code:
  
on *:dialog:search:sclick:2:{ filter -fot mp3list.lis $dname 3 $did(1) }
Posted By: LocutusofBorg Re: Help with searching a file - 11/09/03 08:45 PM
He wanted matches - he never said anything about alphabetically sorted...
Posted By: cybah Re: Help with searching a file - 11/09/03 08:51 PM
It's a lill' extra :tongue:
And btw if he doesn't want the alphabetically sorted thingy he just has to remove the t in -fot.
Posted By: Knappen Re: Help with searching a file - 12/09/03 02:01 PM
Thanks for your help! But the filter command doesnt work.. /filter: invalid parameters

But I got it to work now.. with this code: if ($did(1) isin $read(mp3list.lis, %num))

But when i search for a song and it finds match(s), each match gets added twice..
Why? Is there a way to get rid of the second entry?
© mIRC Discussion Forums