I am trying to read some very large log files and put them into a graphical interface to make it easier for the average tech to read them.
I am having a problem with the incrementation of my counter in the functions of Increase() and Decrease().
I am sure that I have my logic messed up somewhere but I just am not getting it. Please help.
Here is the code
Code:
Break On
Global $D[], $T[], $E[], $C[], $TE[], $BY, $count
Dim $Input, $file, $read, $DT, $er[], $rb[]
;Later add text box to let user specify the file they want to read
$File = "Unity_TSP.txt"
$Count = 0
$System = CreateObject("Kixtart.System")
;KD START
$Form = $System.Form()
$Form.BackColor = 212,208,200
$Form.Height = 432
$Form.Left = 233
$Form.Text = "Error Log Reader"
$Form.Top = 55
$Form.Width = 678
$Server = $Form.Controls.Label()
$Server.BackColor = 212,208,200
$Server.Height = 23
$Server.Left = 105
$Server.Text = ""
$Server.Top = 15
$Server.Width = 100
$Label3 = $Form.Controls.Label()
$Label3.BackColor = 212,208,200
$Label3.Height = 23
$Label3.Left = 0
$Label3.Text = "Date"
$Label3.Top = 45
$Label3.Width = 100
$Label4 = $Form.Controls.Label()
$Label4.BackColor = 212,208,200
$Label4.Height = 23
$Label4.Left = 0
$Label4.Text = "Server Name"
$Label4.Top = 15
$Label4.Width = 100
$Date = $Form.Controls.Label()
$Date.BackColor = 212,208,200
$Date.Height = 23
$Date.Left = 105
$Date.Text = ""
$Date.Top = 45
$Date.Width = 100
$Label6 = $Form.Controls.Label()
$Label6.BackColor = 212,208,200
$Label6.Height = 23
$Label6.Left = 225
$Label6.Text = "Time"
$Label6.Top = 45
$Label6.Width = 100
$Time = $Form.Controls.Label()
$Time.BackColor = 212,208,200
$Time.Height = 23
$Time.Left = 330
$Time.Text = ""
$Time.Top = 45
$Time.Width = 100
$Label8 = $Form.Controls.Label()
$Label8.BackColor = 212,208,200
$Label8.Height = 23
$Label8.Left = 0
$Label8.Text = "Error Type"
$Label8.Top = 75
$Label8.Width = 100
$LER = $Form.Controls.Label()
$LER.BackColor = 212,208,200
$LER.Height = 23
$LER.Left = 105
$LER.Text = ""
$LER.Top = 75
$LER.Width = 100
$Label10 = $Form.Controls.Label()
$Label10.BackColor = 212,208,200
$Label10.Height = 23
$Label10.Left = 0
$Label10.Text = "Reported By:"
$Label10.Top = 105
$Label10.Width = 100
$Reporter = $Form.Controls.Label()
$Reporter.BackColor = 212,208,200
$Reporter.Height = 23
$Reporter.Left = 105
$Reporter.Text = ""
$Reporter.Top = 105
$Reporter.Width = 100
$Label12 = $Form.Controls.Label()
$Label12.BackColor = 212,208,200
$Label12.Height = 23
$Label12.Left = 0
$Label12.Text = "Error Message"
$Label12.Top = 150
$Label12.Width = 100
$Record = $Form.Controls.Label()
$Record.BackColor = 212,208,200
$Record.Height = 23
$Record.Left = 225
$Record.Top = 150
$Record.Width = 100
$Record.Text = ""
$EC = $Form.Controls.Label()
$EC.BackColor = 212,208,200
$EC.Height = 178
$EC.Left = 15
$EC.Text = ""
$EC.Top = 180
$EC.Width = 634
$Button1 = $Form.Controls.Button()
$Button1.FontSize = 12
$Button1.Height = 23
$Button1.Left = 90
$Button1.Text = "<<"
$Button1.Top = 375
$Button1.Width = 75
$Button1.OnClick = "Decrease($count)"
$Button2 = $Form.Controls.Button()
$Button2.FontSize = 12
$Button2.Height = 23
$Button2.Left = 240
$Button2.Text = ">>"
$Button2.Top = 375
$Button2.Width = 75
$Button2.OnClick = "Increase($count)"
$Button3 = $Form.Controls.Button()
$Button3.Height = 23
$Button3.Left = 495
$Button3.Text = "Exit"
$Button3.Top = 375
$Button3.Width = 75
$Button3.OnClick = "Cancel()"
;KD END
;Build Arrays.
;+++++++
Open(1,$file)
$input = Readline(1)
While @Error = 0
Redim Preserve $D[$count]
Redim Preserve $T[$count]
Redim Preserve $E[$count]
Redim Preserve $C[$count]
Redim Preserve $TE[$count]
Redim Preserve $BY[$count]
$read = Split($input," ")
$DT = Split($read[0]," ")
$Er = Split($read[1],".")
$RB = Split($read[3],":")
$D[$count] = $DT[0]
$T[$count] = $DT[1]
$E[$count] = $Er[1]
$C[$count] = $read[2]
$TE[$count] = $read[3]
$BY[$count] = $RB[0]
$count = $count +1
$input = Readline(1)
Loop
Close (1)
$count = 0
Update($count)
$Form.Show
While $Form.Visible
$=Execute($Form.DoEvents())
Loop
Exit 1
Function Update ($count)
If $count = 0
$Button1.Enable = "False"
Else
$Button1.Enable = "True"
EndIf
If $Count = Ubound($TE)
$Button2.Enable = "False"
Else
$Button2.Enable = "True"
EndIf
$Server.Text = $C[$count]
$Date.Text = $D[$count]
$Time.Text = $T[$count]
$Reporter.Text = $BY[$count]
$LER.Text = $E[$count]
$EC.Text = $TE[$count]
$Record.Text = "Record "+($count+1)+" of "+Ubound($TE)
EndFunction
Function Increase($count)
$count = $count+1
Update($count)
EndFunction
Function Decrease($count)
$count = $count-1
update($count)
EndFunction
Function Cancel()
Quit(1)
EndFunction
Here is a sample input line from the file (it is a single line, broken here to prevent window scrolling)
2005-05-11 10:24:52 Daemon.Warning hcphxuvm00000 CiscoUnity_TSP: N/A: Cisco Unity-CM TSP device 4 (Cisco Unity port 1): Failed blind transfer to extension 74400. Busy tone detected. If this is a persistent problem, it may indicate a problem on the Cisco Unity and/or Cisco CallManager. Verify that transfers are working. For more information, click: http://www.CiscoUnitySupport.com/find.php
[Long line removed by NTDOC]