girlinterrupted24
Programmer
Hello there,
I don't know if I am on the right track at all... or whether what I want to do is possible... I basically would like to extract all filenames of files found in a folder, and to place these file names into an array... the orinal non dynamic version which works is this :
var theImageList = new Array(
// Name, URL
["Library image 1", "/images/library/1.jpg"],
["Library image 2", "/images/library/2.jpg"],
["Library image 2", "/images/library/3.jpg"]
);
This is what I have tried to do to make it dynamically extract all files found in folder, so these update automatically if files are added/deleted... but no luck as it doesn't work...
var fso = new ActiveXObject( 'Scripting.FileSystemObject' ),
e, f, i = [];
if( fso.FolderExists( 'c:\inetpub\ ) ) {
f = fso.GetFolder( 'c:\inetpub\ );
var tinyMCEImageList = new Array(
// Name, URL
e = new Enumerator(f.files);
for( ; !e.atEnd(); e.moveNext() ) {
if( ( i = e.item() ) ) { ["Library image " + i, i]; }
}
);
}
I would be ever so grateful for any help anyone could offer on getting this to work....Thank you
I don't know if I am on the right track at all... or whether what I want to do is possible... I basically would like to extract all filenames of files found in a folder, and to place these file names into an array... the orinal non dynamic version which works is this :
var theImageList = new Array(
// Name, URL
["Library image 1", "/images/library/1.jpg"],
["Library image 2", "/images/library/2.jpg"],
["Library image 2", "/images/library/3.jpg"]
);
This is what I have tried to do to make it dynamically extract all files found in folder, so these update automatically if files are added/deleted... but no luck as it doesn't work...
var fso = new ActiveXObject( 'Scripting.FileSystemObject' ),
e, f, i = [];
if( fso.FolderExists( 'c:\inetpub\ ) ) {
f = fso.GetFolder( 'c:\inetpub\ );
var tinyMCEImageList = new Array(
// Name, URL
e = new Enumerator(f.files);
for( ; !e.atEnd(); e.moveNext() ) {
if( ( i = e.item() ) ) { ["Library image " + i, i]; }
}
);
}
I would be ever so grateful for any help anyone could offer on getting this to work....Thank you