M
Michael J Whitmore
I suppose I am asking this because I am hardheaded but here you go.
Is there another way to cycle through a list of Files/Folder
collection besides the use of Enumeration? I really want to use a for
loop because the other way looks so ugly (not to mention the
limitations of only being able to sequentially access the list), but
the following blows up when I try to access the individual folders in
the collection:
Blows up in the for loop:
FSO = new ActiveXObject("Scripting.FileSystemObject");
Folder = FSO.GetFolder(CurrentDirectory);
SubFolders = Folder.SubFolders;
alert(SubFolders.Count); // <==This works I get a number
for (Index=0; Index<SubFolders.Count; Index++) {
alert(Index);
FolderObject = SubFolders[Index].Item(); <== Blows up
}
I have tried many variations on how to get the individual FolderObject
out of the collection but none of them work. Any help would be
appreciated.
This works but gives me hives…
FSO = new ActiveXObject("Scripting.FileSystemObject");
Folder = FSO.GetFolder(CurrentDirectory);
CurrentDirectoryName = Folder.Name;
SubFolders = Folder.SubFolders;
SubFoldersEnum = new Enumerator(SubFolders);
for (; !SubFoldersEnum.atEnd(); SubFoldersEnum.moveNext()) {
FolderObject = SubFoldersEnum.item();
FolderObjectName = FolderObject.Name
alert("loadsystem.js - FolderObjectName : " +FolderObjectName)
}
Thanks!!!
Michael J Whitmore
Is there another way to cycle through a list of Files/Folder
collection besides the use of Enumeration? I really want to use a for
loop because the other way looks so ugly (not to mention the
limitations of only being able to sequentially access the list), but
the following blows up when I try to access the individual folders in
the collection:
Blows up in the for loop:
FSO = new ActiveXObject("Scripting.FileSystemObject");
Folder = FSO.GetFolder(CurrentDirectory);
SubFolders = Folder.SubFolders;
alert(SubFolders.Count); // <==This works I get a number
for (Index=0; Index<SubFolders.Count; Index++) {
alert(Index);
FolderObject = SubFolders[Index].Item(); <== Blows up
}
I have tried many variations on how to get the individual FolderObject
out of the collection but none of them work. Any help would be
appreciated.
This works but gives me hives…
FSO = new ActiveXObject("Scripting.FileSystemObject");
Folder = FSO.GetFolder(CurrentDirectory);
CurrentDirectoryName = Folder.Name;
SubFolders = Folder.SubFolders;
SubFoldersEnum = new Enumerator(SubFolders);
for (; !SubFoldersEnum.atEnd(); SubFoldersEnum.moveNext()) {
FolderObject = SubFoldersEnum.item();
FolderObjectName = FolderObject.Name
alert("loadsystem.js - FolderObjectName : " +FolderObjectName)
}
Thanks!!!
Michael J Whitmore