mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2003
Posts: 7
F
fturtle Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jun 2003
Posts: 7
I wrote a simple script that echos a log file into an @ window, so as to be able to see original mIRC colors in the file.

Problem is that for every instance of " | " in the files (space on both sides) mIRC interprets that as a separator for commands.

An example can be seen in topics, which commonly have stuff like: this is some news | here is some more news

on a line like that, mIRC's $read will pick up "this is some news" and then display something like "HERE unknown command" in the status window, since "here" is what came after the |. So basically it's trying to do /here is some more news.

The "n" switch for $read doesn't affect this, since it's only for variables and identifiers. I've tried multiple things, including tokenizing, $remove, blah blah.... everything stops at the " | " while doing whatever it's doing, and tries to execute what comes after.

Anyone know how to fix? Here's the alias I have so far. To test, try using it on a text file or something with a few lines, one being like "something | something2"

lview {
if ($1 == reset) {
unset %lv.logdir
echo -a 4* Choose a new log directory.
}
if (%lv.logdir == $null) {
%lv.logdir = $sdir($mircdir,Select your log directory)
echo -a 4* Log directory set to %lv.logdir
echo -a 4* Rerun to read logs.
halt
}
window -ae @LogView
clear @LogView
set -u0 %lv.file $sfile(%lv.logdir,Select log to view)
set -u0 %lv.curline 1
echo @LogView 4*
echo @LogView 4* Reading: %lv.file ( $+ $lines(%lv.file) lines)
echo @LogView 4*
while (%lv.curline <= $lines(%lv.file)) {
if ($read(%lv.file,%lv.curline) == $null) echo @LogView $chr(160)
else {
echo @LogView $read(%lv.file,n,%lv.curline)
}
inc %lv.curline
}
}

Thanks.

Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
/help $read

$read(filename, [ntswr], [matchtext], [N])
If the n switch is specified then the line read in will not be evaluated and will be treated as plain text.


-KingTomato
Joined: Jun 2003
Posts: 7
F
fturtle Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jun 2003
Posts: 7
Please read my entire post...that does not work. I'm aware of the "n" switch, and the help file wink. If you look at my alias, you'll notice it has n in there.

Last edited by fturtle; 06/12/03 05:08 AM.
Joined: Apr 2003
Posts: 426
Fjord artisan
Offline
Fjord artisan
Joined: Apr 2003
Posts: 426
$eval($replace($read(file.txt),|,$chr(124))

Something along those lines should work smile


--------
mIRC - fun for all the family (except grandma and grandpa)
Joined: Jun 2003
Posts: 7
F
fturtle Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jun 2003
Posts: 7
Nevermind...I'm retarded for not noticing that I left it out of the first $read (in the if statement) ...sorry, hehehrhaahea. Thanks for the responses smile.


Link Copied to Clipboard