Vbscript and HTA Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I currently have some code to read a log file and then display it in a table
format in my HTA. However, I am unable to write to the next row of the
table. The first row writes perfectly fine but it will not create a new row.


Here is the sample code

Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("\\resource\Installs\Scripts\Employee
Management Script\HTALog.txt", ForReading)
Do Until objFile.AtEndOfStream
strline = objfile.ReadLine
arrPath2 = Split(strLine, " ") 'The Arrpath is split by 5 spaces
Admin = arrpath2(1)
If admin = "Administrator: " & Right(arrPath(0), intNameLength) Then
strScript = "<table width=" & Chr(34) & "90%" & Chr(34) & " border>"
strScript = strScript & " <tr>" & vbCrLf
strScript = strScript & " <td width=" & Chr(34) & "20%" & Chr(34) &
" valign=" & Chr(34) & "top" & Chr(34) & ">" & Chr(34) & ArrPath2(0) &
Chr(34) & "</td>" & vbCrLf
strScript = strScript & " <td width=" & Chr(34) & "25%" & Chr(34) &
" valign=" & Chr(34) & "top" & Chr(34) & ">" & Chr(34) & ArrPath2(1) &
Chr(34) & "</td>" & vbCrLf
strScript = strScript & " <td width=" & Chr(34) & "32%" & Chr(34) &
" valign=" & Chr(34) & "top" & Chr(34) & ">" & Chr(34) & ArrPath2(2) &
Chr(34) & "</td>" & vbCrLf
strScript = strScript & " <td width=" & Chr(34) & "35%" & Chr(34) &
" valign=" & Chr(34) & "top" & Chr(34) & ">" & Chr(34) & ArrPath2(3) &
Chr(34) & "</td>" & vbCrLf
strScript = strScript & " </tr>" & vbCrLf
End If
Loop

strScript = strScript & "</table>" & vbCrLf
main.InnerHTML = strScript
objFile.Close
 
Paul said:
Hi,

I currently have some code to read a log file and then display it in a table
format in my HTA. However, I am unable to write to the next row of the
table. The first row writes perfectly fine but it will not create a new row.


Here is the sample code

Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("\\resource\Installs\Scripts\Employee
Management Script\HTALog.txt", ForReading)
Do Until objFile.AtEndOfStream
strline = objfile.ReadLine
arrPath2 = Split(strLine, " ") 'The Arrpath is split by 5 spaces
Admin = arrpath2(1)
If admin = "Administrator: " & Right(arrPath(0), intNameLength) Then
strScript = "<table width=" & Chr(34) & "90%" & Chr(34) & " border>"
strScript = strScript & " <tr>" & vbCrLf
strScript = strScript & " <td width=" & Chr(34) & "20%" & Chr(34) &
" valign=" & Chr(34) & "top" & Chr(34) & ">" & Chr(34) & ArrPath2(0) &
Chr(34) & "</td>" & vbCrLf
strScript = strScript & " <td width=" & Chr(34) & "25%" & Chr(34) &
" valign=" & Chr(34) & "top" & Chr(34) & ">" & Chr(34) & ArrPath2(1) &
Chr(34) & "</td>" & vbCrLf
strScript = strScript & " <td width=" & Chr(34) & "32%" & Chr(34) &
" valign=" & Chr(34) & "top" & Chr(34) & ">" & Chr(34) & ArrPath2(2) &
Chr(34) & "</td>" & vbCrLf
strScript = strScript & " <td width=" & Chr(34) & "35%" & Chr(34) &
" valign=" & Chr(34) & "top" & Chr(34) & ">" & Chr(34) & ArrPath2(3) &
Chr(34) & "</td>" & vbCrLf
strScript = strScript & " </tr>" & vbCrLf
End If
Loop

strScript = strScript & "</table>" & vbCrLf
main.InnerHTML = strScript
objFile.Close

Best posted in a scripting newsgroup.
 
Back
Top