home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
MODEM
/
QWSAMPLE.ZIP
/
LOGTOTAL.SCR
next >
Wrap
Text File
|
1994-01-11
|
3KB
|
118 lines
' This script reads a QmodemPro for Windows log file and produces a total
' summary of the connect times.
dialog FilenameDialog 100, 100, 200, 90
caption "Report log file summary"
groupbox "", -1, 5, 5, 190, 55
ltext "Log file", -1, 10, 16, 40, 12
LogFile as edittext 101, 50, 15, 130, 12
ltext "Output file", -1, 10, 36, 40, 12
OutputFile as edittext 102, 50, 35, 130, 12
defpushbutton "OK", IDOK, 40, 65, 50, 14
pushbutton "Cancel", IDCANCEL, 110, 65, 50, 14
end dialog
dim fd as FilenameDialog
const MaxNames = 100
dim names(MaxNames) as string
dim times(MaxNames) as integer
dim count as integer
dim index as integer
dim firstdate as string
dim lastdate as string
function ReadLogFile as integer
ReadLogFile = False
open fd.LogFile for input as #1
print "Processing...";
do while not eof(1)
dim s as string
input #1, s
if mid(s, 3, 1) = ":" then
if firstdate = "" then
firstdate = mid(s, 10, 8)
end if
lastdate = mid(s, 10, 8)
if mid(s, 20, 10) = "Connect to" then
dim sname as string
sname = mid(s, 31, instr(s, " at ")-31)
index = 1
do while index <= count
if sname = names(index) then
exit do
end if
index = index + 1
loop
if index > count and index <= MaxNames then
names(index) = sname
times(index) = 0
count = index
end if
print ".";
elseif mid(s, 20, 18) = "Total connect time" and index > 0 then
times(index) = times(index) + val(mid(s, 39, 2))*3600 + val(mid(s, 42, 2))*60 + val(mid(s, 45, 2))
index = 0
end if
end if
loop
close #1
print
ReadLogFile = True
catch err_fileopen
MsgBox "Error opening log file "+fd.LogFile
end function
function PrintResults as integer
PrintResults = False
open fd.OutputFile for output as #1
print #1, "QmodemPro for Windows Log Summary"
print #1, "================================="
print #1,
print #1, "Starting date: "; firstdate
print #1, " Ending date: "; lastdate
print #1,
print #1, "Service name Total time"
print #1, "------------------------------ ----------"
if count > 0 then
for index = 1 to count
print #1, names(index); space(35-len(names(index)));
dim hours as integer, minutes as integer, seconds as integer
hours = times(index)/3600
minutes = int(times(index)/60) mod 60
seconds = times(index) mod 60
print #1, space(3-len(str(hours))); hours; ":";
if minutes < 10 then
print #1, "0";
end if
print #1, minutes; ":";
if seconds < 10 then
print #1, "0";
end if
print #1, seconds
next
else
print #1, "(no entries found)"
end if
print #1,
close #1
PrintResults = True
catch err_fileopen
MsgBox "Error creating log file "+fd.OutputFile
end function
fd.LogFile = "qmwin.log"
fd.OutputFile = "qmwin.out"
if dialogbox(fd) = IDCANCEL then end
firstdate = ""
lastdate = ""
count = 0
index = 0
if ReadLogFile then
if PrintResults then
viewfile fd.OutputFile
end if
end if