ABA3D Posted February 8, 2012 Share Posted February 8, 2012 hi im writing an app with javascript fso to display a file sequence in a list but im having a problem with the display it displays the whole sequence or the second file insted the first file of the sequence .here is the code: function loadRenderFolders(){var FSO = new ActiveXObject("Scripting.FileSystemObject");var Stable = "";var Etable = "";var Str = "";var Etr = "";var s="";var abc = new Array();var i=0; var f = FSO.GetFolder("Render\\images\\Sh02\\v_03\\");var enumtor = new Enumerator(f.Files); Stable = "<table cellpadding=0 cellspacing=0 border=0>"; for (; !enumtor.atEnd(); enumtor.moveNext()) { var name = enumtor.item().Name; abc[i]=name; i++; s += "<tr><td nowrap style=\"width:320; height:40; font-size:20; font-family:Calibri; color:#FFFFFF;\" onMouseOver=\"this.style.background='#1f1c29';\" onMouseOut=\"this.style.background='';\"> "+abc[0]+"</td></tr>"; }Etable = "</table>";renderList.innerHTML=Stable+s+Etable;} Link to comment Share on other sites More sharing options...
thescientist Posted February 8, 2012 Share Posted February 8, 2012 Well, from the looks of it you are always hardcoding your output to abc[0], so that's going to be a problem. I'm not sure why you are using an array to prestore the value before you use it, when you get name right from your enumerator class. I can only infer the functionality of these classes since I've never used/heard of them, but perhaps this would work function loadRenderFolders(){ var FSO = new ActiveXObject("Scripting.FileSystemObject"); var f = FSO.GetFolder("Render\\images\\Sh02\\v_03\\"); var enumtor = new Enumerator(f.Files); var Stable = "<table cellpadding=0 cellspacing=0 border=0>";; var Etable = "</table>"; var Btable = ""; for (; !enumtor.atEnd(); enumtor.moveNext()){ var name = enumtor.item().Name; Btable += "<tr><td nowrap style=\"width:320; height:40; font-size:20; font-family:Calibri; color:#FFFFFF;\" onMouseOver=\"this.style.background='#1f1c29';\" onMouseOut=\"this.style.background='';\"> "+ name +"</td></tr>"; }; renderList.innerHTML = Stable + Btable + Etable;} Link to comment Share on other sites More sharing options...
ABA3D Posted February 14, 2012 Author Share Posted February 14, 2012 thanks for the replay but i meant that i need to display the first file name of the sequences for example lets say that i have a files sequence called: color.001.sgicolor.002.sgicolor.003.sgi shadow.001.sgishadow.002.sgishadow.003.sgi thats what the script is doing right now it displays all the sequences but what i need is to display only the first file of each sequence for exemple: color.001.sgishadow.001.sgi thanks for the help Link to comment Share on other sites More sharing options...
thescientist Posted February 14, 2012 Share Posted February 14, 2012 then don't use a loop? That would seem the most obvious to me. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.