mIRC Home    About    Download    Register    News    Help

Print Thread
#12191 20/02/03 03:25 PM
Joined: Feb 2003
Posts: 27
L
Lowest Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Feb 2003
Posts: 27
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

#12192 20/02/03 05:36 PM
Joined: Dec 2002
Posts: 77
B
Babel fish
Offline
Babel fish
B
Joined: Dec 2002
Posts: 77
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.

#12193 20/02/03 08:25 PM
Joined: Feb 2003
Posts: 27
L
Lowest Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Feb 2003
Posts: 27
oh I see thanks

#12194 22/02/03 11:16 AM
Joined: Feb 2003
Posts: 27
L
Lowest Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Feb 2003
Posts: 27
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?

#12195 22/02/03 07:12 PM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
This one could be simply
Code:
alias Removefle while $fline(@filelist,*.avi,1) { dline @filelist $ifmatch }


Link Copied to Clipboard