I know how to read a text file into a select box...
Sub LoadClass
strNewFile = "classes.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile _
(strNewFile, ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
Set objOption = Document.createElement("OPTION")
objOption.Text = strLine
objOption.Value = strLine
className.Add(objOption)
Loop
objFile.Close
End subAnd I know how to read a list of folders into a variable [array?]
Sub ShowFolderList(folderspec)
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.SubFolders
For Each f1 in fc
s = s & f1.name
s = s & vbCrLf
Next
MsgBox s
End SubBut I can't seem to combine them such that selecting a folder allows me to fill a select box with a list of subfolders from that folder.
here's the contents of my HTA as it stands now:
<HTML xmlns:IE><HEAD><TITLE>Production Recording App</TITLE><HTA:APPLICATION
ID="Production"
VERSION="0.0.1"
APPLICATIONNAME="Production Recording App"
SYSMENU="yes"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
BORDER="thin"
INNERBORDER="thin"
SCROLL="auto"
SINGLEINSTANCE="yes"
WINDOWSTATE="Normal"><STYLE>
@media all
{
IE\:Calendar { behavior : url(calendar.htc) }
a { color : cyan }
a:active { color : red }
a:hover { color : yellow }
}<!--
.style1 {
;
margin-left: -437px;
margin-right: -437px;
border-width: medium;
background-color: #C0C0C0;
width: 883px;
border-style: ridge;
left: 50%;
}
.newStyle1 {
border-style: ridge none none none;
padding: 3px;
text-align: center;
float: left;
background-color: #C0C0C0;
width: 315px;
}
.newStyle2 {
text-align: left;
padding: 3px 3px 3px 10px;
border-style: ridge none none none;
float: left;
background-color: #C0C0C0;
width: 315px;
}
.RightCenter {
text-align: center;
padding: 3px;
border-style: ridge none none ridge;
float: right;
background-color: #C0C0C0;
width: 556px;
}
.newStyle {
border-style: none none ridge none;
padding: 0px;
text-align: center;
float: left;
background-color: #000066;
width: 875px;
color: #FFFFFF;
}
--></STYLE><SCRIPT LANGUAGE="VBScript">
CONST ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Dim strAppName, strAppVer
strAppName = Production.ApplicationName
strAppVer = Production.Version
strFolderPath = "E:\Production"
Sub Window_OnLoad( )
window.resizeTo 1000,650
End Sub
Sub LoadSessions
If userselections.txtFile.value = "" Then
Else
folderspec = userselections.txtFile.value
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fl = CreateObject("Scripting.FileSystemObject")
Set fc = f.SubFolders
For Each f1 in fc
strSession.add(fl)
Next
End If
End sub
Sub ChooseSaveFolder
strStartDir = "E:\Production"
userselections.txtFile.value = PickFolder(strStartDir)
strFolderPath = userselections.txtFile.value
LoadSessions
End Sub
Function PickFolder(strStartDir)
Dim SA, F
Set SA = CreateObject("Shell.Application")
Set F = SA.BrowseForFolder(0, "Choose a folder", 0, strStartDir)
If (Not F Is Nothing) Then
PickFolder = F.Items.Item.path
End If
Set F = Nothing
Set SA = Nothing
End Function </SCRIPT><body><div Class ="style1" ><div class="newStyle1"><form name="userselections"><label id="Label1">
Browse for main program folder <br><em>[only chose program level [EG: EPD]<br></em></label><input type = "text" name = "txtFile" size="50" /><input type = "button" value = "Browse ..." onClick="ChooseSaveFolder" /></form><label id="Label1">
Select Existing Recording Name or enter a new one.<br><select size="1" name="strSession" style="width:300"></select></div></div></BODY></HTML>I get line 97 char 7 invalid argument inside the loadsessions sub.