Rambeaux007
IS-IT--Management
Hello All!
I am working on a HTA file that will parse thru a text file then output the last 5 or 6 lines of the text file to a Textbox. The script runs but only outputs 1 of the 5 readouts on the screen. I'm stuck. Please help!
<head>
<HTA:APPLICATION
APPLICATIONNAME="HPSA Utility v2.0"
SCROLL="yes"
SINGLEINSTANCE="yes"
>
</head>
<script language="VBScript">
Sub ParseTextFile
Dim arrFileLines(), i, Line, l
Dim objFSOAgent, objFileAgent
i = 0
Set objFSOAgent = CreateObject("Scripting.FileSystemObject")
Set objFileAgent = objFSOAgent.OpenTextFile("c:\textfile.txt", 1)
Do Until objFileAgent.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFileAgent.ReadLine
i = i + 1
Loop
objFileAgent.Close
Line = 0
For l = Ubound(arrFileLines) to LBound(arrFileLines) Step -1
ParseTextFile_Text.value = arrFileLines(l)
Line = Line + 1
If Line = 6 Then
Exit For
End If
Next
End Sub
Sub TestSub
If ParseTextFile_Check.Checked Then
Call ParseTextFile
End Sub
</script>
<body>
<p>
<span id = "DataArea"></span><br>
<input type="checkbox" name="ParseTextFile_Check"> ParseHPSA
<br>
<textarea name="ParseTextFile_Text" rows=10 cols=100></textarea><br><br>
<input id=runbutton type="button" value="Run" name="run_button" onClick="TestSub">
<br>
</body>
I am working on a HTA file that will parse thru a text file then output the last 5 or 6 lines of the text file to a Textbox. The script runs but only outputs 1 of the 5 readouts on the screen. I'm stuck. Please help!
<head>
<HTA:APPLICATION
APPLICATIONNAME="HPSA Utility v2.0"
SCROLL="yes"
SINGLEINSTANCE="yes"
>
</head>
<script language="VBScript">
Sub ParseTextFile
Dim arrFileLines(), i, Line, l
Dim objFSOAgent, objFileAgent
i = 0
Set objFSOAgent = CreateObject("Scripting.FileSystemObject")
Set objFileAgent = objFSOAgent.OpenTextFile("c:\textfile.txt", 1)
Do Until objFileAgent.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFileAgent.ReadLine
i = i + 1
Loop
objFileAgent.Close
Line = 0
For l = Ubound(arrFileLines) to LBound(arrFileLines) Step -1
ParseTextFile_Text.value = arrFileLines(l)
Line = Line + 1
If Line = 6 Then
Exit For
End If
Next
End Sub
Sub TestSub
If ParseTextFile_Check.Checked Then
Call ParseTextFile
End Sub
</script>
<body>
<p>
<span id = "DataArea"></span><br>
<input type="checkbox" name="ParseTextFile_Check"> ParseHPSA
<br>
<textarea name="ParseTextFile_Text" rows=10 cols=100></textarea><br><br>
<input id=runbutton type="button" value="Run" name="run_button" onClick="TestSub">
<br>
</body>