mIRC Homepage
Posted By: Lowest While loop / remove line - 20/02/03 03:25 PM
why doesn't this work?

Code:
alias Removefle { 
  var %fle = 1
  while (%fle <= $line(@filelist,N)) {
    if (.avi isin $line(@filelist,%fle)) { dline @filelist %fle }
    inc %fle
  }
}


It kind of works, but when theres a load of files it doesn't remove them all so i have to run it again, and sometimes it'll remove files without the .avi extension in
Posted By: BlackAle Re: While loop / remove line - 20/02/03 05:36 PM
It's not working because you're removing the line AND then incrementing the counter. This will miss out the item that replaces the one you've deleted.

You should either delete the line OR increment, or run the loop in reverse going from the end to the start.
Posted By: Lowest Re: While loop / remove line - 20/02/03 08:25 PM
oh I see thanks
Posted By: Lowest Re: While loop / remove line - 22/02/03 11:16 AM
Sorry but i need more help

Code:
alias RemoveM3u { 
  var %m3u = $line(@filelist,N)
  while (%m3u != 0) {
    if (.mp3 !isin $line(@filelist,%m3u)) || (.ogg !isin $line(@filelist,%m3u)) { dline @filelist %m3u | did -d player 8 %m3u }
    dec %m3u
  }
}  


why doesn't it work?
Posted By: Nimue Re: While loop / remove line - 22/02/03 07:12 PM
This one could be simply
Code:
alias Removefle while $fline(@filelist,*.avi,1) { dline @filelist $ifmatch }
© mIRC Discussion Forums