http://dieseyer.de • all rights reserved • © 2011 v11.4

<html>
<head>
<title>Load Computers Sample</title>
<HTA:APPLICATION
ID="objTestHTA"
APPLICATIONNAME="Load Computers Sample"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximize"
>
</head>

<SCRIPT Language="VBScript">

Sub LoadComputers

Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "Text Files|*.txt|All Files|*.*"
objDialog.FilterIndex = 1
objDialog.InitialDir = "C:\Scripts"
intResult = objDialog.ShowOpen

If intResult = 0 Then
Exit Sub
End If

For Each objOption in AvailableComputers.Options
objOption.RemoveNode
Next

ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile _
(objDialog.FileName, ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
Set objOption = Document.createElement("OPTION")
objOption.Text = strLine
objOption.Value = strLine
AvailableComputers.Add(objOption)
Loop
objFile.Close

End Sub

</SCRIPT>

<body bgcolor="buttonface">
<input id=runbutton class="button" type="button" value="Load Computers"
name="run_button" onClick="LoadComputers"><p>

<select size="10" name="AvailableComputers" style="width:300" >
</select>

</body>
</html>

http://dieseyer.de • all rights reserved • © 2011 v11.4