My option buttons are not working! When I click on one of them. the bullet
turns grey momentarily but does not stick. I just can't figure out why! Can
someone help me!
The purpose of this script will be to enumerate files in the current folder.
Select the files and it will eventually (not yet implemented) compare files
select.
<html>
<head>
<HTA:APPLICATION
APPLICATIONNAME="Compare Files"
SCROLL="no"
SINGLEINSTANCE="no">
<script language="VBScript">
Sub GetLogs
Dim btnCompare, objForm, i, objElement
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
Set objFolder = objFSO.GetFolder(objShell.CurrentDirectory)
Set colFiles = objFolder.Files
Set objForm1 = Document.Forms("log1")
Set objForm2 = Document.Forms("log2")
For Each objFile in colFiles
If InStr (lcase(objFile.Name),"log") Then
Set objElement=document.createElement("input")
With objElement
.type="radio"
.value=objFile.Name
.name="file1"
End With
objForm1.appendChild objElement
Set objElement=document.createElement("input")
With objElement
.type="radio"
.value=objFile.Name
.name="file2"
End With
objForm2.appendChild objElement
Set objElement=document.createTextNode(objFile.Name)
objForm1.appendChild objElement
Set objElement=document.createTextNode(objFile.Name)
objForm2.appendChild objElement
set objElement=document.createElement("br")
objForm1.appendChild objElement
set objElement=document.createElement("br")
objForm2.appendChild objElement
'set objElement=nothing
End If
Next
End Sub
Sub CompareFiles
Dim i
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objResultFile = objFSO.OpenTextFile("comparison.txt", ForWriting,
TRUE)
objResultFile.WriteLine ("test")
For i = 0 to Document.Form.Elements.Count -1
If Document.Form.Elements(i).Name = "file1" Then
If Document.Form.Elements(i).Checked Then
strFile1 = Document.Form.Elements(i).Value
objResultFile.WriteLine = strFile1
Exit For
End if
End if
Next
For i = 0 to Document.Form.Elements.Count -1
If Document.Form.Elements(i).Name = "file2" Then
If Document.Form.Elements(i).Checked Then
strFile2 = Document.Form.Elements(i).Value
objResultFile.WriteLine = strFile1
Exit For
End if
End if
Next
End Sub
</script>
</head>
<body onload="GetLogs">
<table width="100%" border>
<tr>
<td width="50%" valign="top">
<form id="log1">
</form>
</td>
<td width="50%" valign="top">
<form id="log2">
</form>
</td>
</tr>
</table>
<input id=runbutton type="button" value="Compare Files" name="runButton"
onClick="CompareFiles"><p>
</body>
</html>