mIRC Home    About    Download    Register    News    Help

Print Thread
#13611 28/02/03 09:35 PM
Joined: Dec 2002
Posts: 4
W
Self-satisified door
OP Offline
Self-satisified door
W
Joined: Dec 2002
Posts: 4
This is my first time, so here goes...
If someone could tell me how i could make this work error free
even if the logfile is corrupted (from abnormal mIRC shutdown(windows crashed)) I would greatly appreciate it.
The alias is called from the dialog.
It scans the logfile for Session Start: & Session Close: if it finds either of these it adds a token to a %var of the line # found ($readn), the problem is if it doesent find Session Close: it will find the next one, and if there is none it uses the # of lines in the log as the close session line, what happens is the dialog edit will only hold so much, and sometimes it will put 2 sessions in 1.
the code is as follows:
alias -l scanlog {
if ($1) {
openlog $1
set %lv.l $1
var %lv.i = $read($1, nw, *Session Start:*, $iif($numtok(%lv.c, 32) >= 1, $gettok(%lv.c, $ifmatch, 32), 1)) $readn
set %lv.s $addtok(%lv.s, $iif($readn, $readn, $lines($1)), 32)
var %lv.i = $read($1, nw, *Session Close:*, $iif($numtok(%lv.s, 32) >= 1, $gettok(%lv.s, $ifmatch, 32), 1)) $readn
set %lv.c $addtok(%lv.c, $iif($readn, $readn, $lines($1)), 32)
var %lv.ln = $gettok(%lv.s, %lv.sn, 32)
var %lv.ls = $gettok(%lv.c, %lv.sn, 32)
did -r logview 1,2
while (%lv.ln <= %lv.ls) {
if ($read($1, n, %lv.ln) != $null) {
did -a logview 2 $strip($read($1, n, %lv.ln)) $crlf
inc %lv.ln
if ($istok($read($1, n, $calc(%lv.l - 1)), Close:, 32)) {
set %lv.ln %lv.ls
}
}
var %lv.i = $read($1, nw, *Session Start:*, $iif($numtok(%lv.c, 32) >= 1, $gettok(%lv.c, $ifmatch, 32), 1)) $readn
set %lv.s $addtok(%lv.s, $iif($readn, $readn, $lines($1)), 32)
var %lv.i = $read($1, nw, *Session Close:*, $iif($numtok(%lv.s, 32) >= 1, $gettok(%lv.s, $ifmatch, 32), 1)) $readn
set %lv.c $addtok(%lv.c, $iif($readn, $readn, $lines($1)), 32)
dialog -t logview $+(Scanning $remove($1, %lv.d),.....) $+($calc(%lv.ln / %lv.ls * 100), %) $iif($calc(%lv.ln / %lv.ls * 100) >= 100, complete!, complete.)
inc %lv.ln
}
set %lv.ss $numtok(%lv.s, 32)
did -a logview 1 $+(Log:, $remove($1, %lv.d), $chr(32), Session:, %lv.sn, / , %lv.ss)
;logviewtitle $1
}
else {
openlog $$sfile(%lv.d *.log, Select Log, Open &Log)
}
}
alias openlog {
if (!$1) {
scanlog $$sfile(%lv.d *.log, Select Log, Open &Log)
}
if ($1) && ($dialog(logview)) {
set %lv.l $1
dialog -v logview logview
;logviewtitle $1
}
else {
dialog -mdts logview logview -1 -1 258 245 -Eclipse Log Viewer- $iif($1, Scanning $+($remove($1,%lv.d),.....) $+($calc(%lv.ln / %lv.ls * 100), $iif($calc(%lv.ln / %lv.ls * 100) == 0, 0%, %)) complete.) $iif(%lv.sn, $+(Session:,%lv.sn,/,%lv.ss))
}
}
alias -l nexsession {
if (%lv.sn < $numtok(%lv.s, 32)) {
did -r logview 2
inc %lv.sn
scanlog %lv.l
}
}
alias -l presession {
if (%lv.sn != 1) {
did -r logview 2
dec %lv.sn
scanlog %lv.l
}
}
dialog table items needed:
size -1 -1 258 245
box "", 1, 0 1 258 243
edit "", 2, 2 8 254 221, read multi return autohs autovs hsbar vsbar
-------
if there is anything that i have left out that is needed to test, and fix this please let me know.
-
For those who wish to understand the method to my madness,
I have included this variable equivalency list;
-
%lv.d = %logview.dir
%lv.l = %logview.log
%lv.i = %logview.information
%lv.s = %logview.sessionstartlines
%lv.c = %logview.sessioncloselines
%lv.v = %logview.version
%lv.sn = %logview.session
%lv.ss = %logview.sessions
%lv.ln = %logview.logline
%lv.ls = %logview.loglines
%lv.sa = %logview.showabout
%lv.tb = %logview.sendtobin
-
somethings i have commented out as they are not important to this

#13612 28/02/03 10:04 PM
Joined: Jan 2003
Posts: 94
S
Babel fish
Offline
Babel fish
S
Joined: Jan 2003
Posts: 94
check on mircscripts.org addon site and review the code i used for my log viewer 3.0; i did the same thing.

which reminds me i need to update that some time ;\


-
E-Mail: mirc_sabby@hotmail.com
Network: irc.enterthegame.com
Channel: #Helpdesk

Link Copied to Clipboard