mIRC Homepage
Posted By: Uradox Txt file reading - 12/07/04 01:00 PM
I have a small problem with reading a txt file.
I am trying to read a txt file and msg a chan with EVERY line that starts with !SUPPLY. From what iv read in the mirc help file i can only read the first line it finds ;\
msg $chan $read(list.txt, s, !SUPPLY)
Say then also is it possible to delete a line from the txt file if it say contains something like *old news* ?
Posted By: CtrlAltDel Re: Txt file reading - 12/07/04 02:39 PM
put all lines that start with !SUPPLY in a separate text file and use /play (see /play in the help files)
Posted By: Uradox Re: Txt file reading - 13/07/04 11:28 AM
ah yes of course, i feel a bit foolish now such a simple solution.
Now to remove lines request smile sure the help file will mention this clearly
Posted By: Grumpy Re: Txt file reading - 14/07/04 06:22 PM
hmmm, well i haven't really tried that. But if it only gives you a result once, just put it into a while loop.
Code:
%i = 1
%j = $lines(file.txt)
while (%i < %j) {
%text = $read(file.txt , %i)
if (!word isin %text) {
msg # %text
return
}

inc %i
}

Posted By: Coolkill Re: Txt file reading - 14/07/04 08:27 PM
An easier way would be:

alias intplay {
if ($2 == !SUPPLY) { msg $1 $2- }
}

And simply, /play -a /intplay #CHANNEL FILENAME.txt

Changing, both FILENAME.txt and #CHANNEL, that way you wouldnt have to have seperate files.

Eamonn.
© mIRC Discussion Forums