Wrox Home  
Search P2P Archive for: Go

  Return to Index  

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


Message #1 by "Prakash" <pdnaik@m...> on Thu, 7 Mar 2002 15:04:31
i want this fonts list in a select box and it should be operating system 
independent.

> > 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