Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Populating A List Box With Font Names From Client Machine Windows\Fonts Folder


Message #1 by "Paul Mzandu" <paul.mzandu@x...> on Thu, 17 Jan 2002 17:11:29
> well, this will give you a list off all the fonts on the client 
machine...
> if you need more help... just reply
> 
> 
> <script language="javascript">
> function ShowFolderFileList(folderspec)
> {
>    var fso, f, f1, fc, s, t;
>    fso = new ActiveXObject("Scripting.FileSystemObject");
>    f = fso.GetFolder(folderspec);
>    fc = new Enumerator(f.files);
>    s = "";
>    for (; !fc.atEnd(); fc.moveNext())
>    {
> 	  t = fc.item();
> 	  t = fso.GetFileName(fc.item());
> 	  t = t.substr(0,t.length-4)
> 	  s += t;
>       s += "<br>";
>    }
> fc.moveFirst()
> return(s);
> 
> }
> 
> document.write(ShowFolderFileList("C:\\Winnt\\Fonts"))
> </script>
> 
> 
> -----> well, this will give you a list off all the fonts on the client 
machine...
> if you need more help... just reply
> 
> 
> <script language="javascript">
> function ShowFolderFileList(folderspec)
> {
>    var fso, f, f1, fc, s, t;
>    fso = new ActiveXObject("Scripting.FileSystemObject");
>    f = fso.GetFolder(folderspec);
>    fc = new Enumerator(f.files);
>    s = "";
>    for (; !fc.atEnd(); fc.moveNext())
>    {
> 	  t = fc.item();
> 	  t = fso.GetFileName(fc.item());
> 	  t = t.substr(0,t.length-4)
> 	  s += t;
>       s += "<br>";
>    }
> fc.moveFirst()
> return(s);
> 
> }
> 
> document.write(ShowFolderFileList("C:\\Winnt\\Fonts"))
> </script>
> 
> 
> Hi Elliot and thanks for your reply. I tried to execute the above code 
and for sure it worked. I also tried to get the actual font names because 
the above is giving me the File Names. I'm really new to all this.

Thanks Again

  Return to Index