drive letter 
Author Message
 drive letter

Is there any way in Jscript or Javascript to get the drive letter of
client's CD-ROM?

I wrote a drive.htm file. it works fine in IE5, but not in IE 4.0.
In IE 4.0, I got an error saying "automation servers can't create object" on
"fso = new ActiveXObject"("Scripting.FileSystemObject");

Anyone knows why? I tried to lower the security level on IE 4.0.

Thank you.

Here is the code
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JScript">
function ShowDriveList()
{
  var fso, s, n, e, x;
  fso = new ActiveXObject("Scripting.FileSystemObject");
  e = new Enumerator(fso.Drives);
  s = "";
  for (; !e.atEnd(); e.moveNext())
  {
    x = e.item();
    s = s + x.DriveLetter;

  switch (x.DriveType)
  {
 case 0: s += "[Unknown]"; break;
 case 1: s += "[Removable]"; break;
 case 2: s += "[Fixed]"; break;
 case 3: s += "[Network]"; break;
 case 4: s += "[CD-ROM]"; break;
 case 5: s += "[RAM Disk]"; break;
  }

    s += " - ";

    if (x.DriveType == 3)
      n = x.ShareName;
    else if (x.IsReady)
      n = x.VolumeName;
    else
      n = "[Drive not ready]";

    s +=  n + "<br>";
  }
  document.write(s);

Quote:
}

</SCRIPT>
</HEAD>
<BODY>
Your drive info: <BR>
<SCRIPT>
ShowDriveList();
</SCRIPT>
</BODY>
</HTML>


Sun, 11 May 2003 03:00:00 GMT  
 drive letter
The security zone configuration is the same for IE3x and IE4x as it is for IE5x.

Q182569 - Description of Internet Explorer Security Zones Registry Entries
http://support.microsoft.com/support/kb/articles/q182/5/69.asp

Using unsafe components in client side code is OK for personal (and perhaps Intranet) use, but
certainly not for general Internet use.

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup...
--

Quote:

> Is there any way in Jscript or Javascript to get the drive letter of
> client's CD-ROM?

> I wrote a drive.htm file. it works fine in IE5, but not in IE 4.0.
> In IE 4.0, I got an error saying "automation servers can't create object" on
> "fso = new ActiveXObject"("Scripting.FileSystemObject");

> Anyone knows why? I tried to lower the security level on IE 4.0.

> Thank you.

> Here is the code
> <HTML>
> <HEAD>
> <SCRIPT LANGUAGE="JScript">
> function ShowDriveList()
> {
>   var fso, s, n, e, x;
>   fso = new ActiveXObject("Scripting.FileSystemObject");
>   e = new Enumerator(fso.Drives);
>   s = "";
>   for (; !e.atEnd(); e.moveNext())
>   {
>     x = e.item();
>     s = s + x.DriveLetter;

>   switch (x.DriveType)
>   {
>  case 0: s += "[Unknown]"; break;
>  case 1: s += "[Removable]"; break;
>  case 2: s += "[Fixed]"; break;
>  case 3: s += "[Network]"; break;
>  case 4: s += "[CD-ROM]"; break;
>  case 5: s += "[RAM Disk]"; break;
>   }

>     s += " - ";

>     if (x.DriveType == 3)
>       n = x.ShareName;
>     else if (x.IsReady)
>       n = x.VolumeName;
>     else
>       n = "[Drive not ready]";

>     s +=  n + "<br>";
>   }
>   document.write(s);
> }

> </SCRIPT>
> </HEAD>
> <BODY>
> Your drive info: <BR>
> <SCRIPT>
> ShowDriveList();
> </SCRIPT>
> </BODY>
> </HTML>



Tue, 13 May 2003 03:00:00 GMT  
 drive letter
Thanks. But what kind of settings I should change on IE4 to enable 'fso =
new ActiveXObject("Scripting.FileSystemObject");'?

I think I made the same settings on IE 5 and IE 4. Why does the code only
work on IE 5?


Quote:
> The security zone configuration is the same for IE3x and IE4x as it is for
IE5x.

> Q182569 - Description of Internet Explorer Security Zones Registry Entries
> http://support.microsoft.com/support/kb/articles/q182/5/69.asp

> Using unsafe components in client side code is OK for personal (and

perhaps Intranet) use, but
Quote:
> certainly not for general Internet use.

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --

> Please do not email questions - post them to the newsgroup...
> --




Quote:
> > Is there any way in Jscript or Javascript to get the drive letter of
> > client's CD-ROM?

> > I wrote a drive.htm file. it works fine in IE5, but not in IE 4.0.
> > In IE 4.0, I got an error saying "automation servers can't create
object" on
> > "fso = new ActiveXObject"("Scripting.FileSystemObject");

> > Anyone knows why? I tried to lower the security level on IE 4.0.

> > Thank you.

> > Here is the code
> > <HTML>
> > <HEAD>
> > <SCRIPT LANGUAGE="JScript">
> > function ShowDriveList()
> > {
> >   var fso, s, n, e, x;
> >   fso = new ActiveXObject("Scripting.FileSystemObject");
> >   e = new Enumerator(fso.Drives);
> >   s = "";
> >   for (; !e.atEnd(); e.moveNext())
> >   {
> >     x = e.item();
> >     s = s + x.DriveLetter;

> >   switch (x.DriveType)
> >   {
> >  case 0: s += "[Unknown]"; break;
> >  case 1: s += "[Removable]"; break;
> >  case 2: s += "[Fixed]"; break;
> >  case 3: s += "[Network]"; break;
> >  case 4: s += "[CD-ROM]"; break;
> >  case 5: s += "[RAM Disk]"; break;
> >   }

> >     s += " - ";

> >     if (x.DriveType == 3)
> >       n = x.ShareName;
> >     else if (x.IsReady)
> >       n = x.VolumeName;
> >     else
> >       n = "[Drive not ready]";

> >     s +=  n + "<br>";
> >   }
> >   document.write(s);
> > }

> > </SCRIPT>
> > </HEAD>
> > <BODY>
> > Your drive info: <BR>
> > <SCRIPT>
> > ShowDriveList();
> > </SCRIPT>
> > </BODY>
> > </HTML>



Fri, 16 May 2003 03:00:00 GMT  
 drive letter

I don't have access to any box with IE4 so I don't know what the security option wording is...

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup...
--


Quote:
> Thanks. But what kind of settings I should change on IE4 to enable 'fso =
> new ActiveXObject("Scripting.FileSystemObject");'?

> I think I made the same settings on IE 5 and IE 4. Why does the code only
> work on IE 5?



> > The security zone configuration is the same for IE3x and IE4x as it is for
> IE5x.

> > Q182569 - Description of Internet Explorer Security Zones Registry Entries
> > http://support.microsoft.com/support/kb/articles/q182/5/69.asp

> > Using unsafe components in client side code is OK for personal (and
> perhaps Intranet) use, but
> > certainly not for general Internet use.

> > --
> > Michael Harris
> > Microsoft.MVP.Scripting
> > --

> > Please do not email questions - post them to the newsgroup...
> > --



> > > Is there any way in Jscript or Javascript to get the drive letter of
> > > client's CD-ROM?

> > > I wrote a drive.htm file. it works fine in IE5, but not in IE 4.0.
> > > In IE 4.0, I got an error saying "automation servers can't create
> object" on
> > > "fso = new ActiveXObject"("Scripting.FileSystemObject");

> > > Anyone knows why? I tried to lower the security level on IE 4.0.

> > > Thank you.

> > > Here is the code
> > > <HTML>
> > > <HEAD>
> > > <SCRIPT LANGUAGE="JScript">
> > > function ShowDriveList()
> > > {
> > >   var fso, s, n, e, x;
> > >   fso = new ActiveXObject("Scripting.FileSystemObject");
> > >   e = new Enumerator(fso.Drives);
> > >   s = "";
> > >   for (; !e.atEnd(); e.moveNext())
> > >   {
> > >     x = e.item();
> > >     s = s + x.DriveLetter;

> > >   switch (x.DriveType)
> > >   {
> > >  case 0: s += "[Unknown]"; break;
> > >  case 1: s += "[Removable]"; break;
> > >  case 2: s += "[Fixed]"; break;
> > >  case 3: s += "[Network]"; break;
> > >  case 4: s += "[CD-ROM]"; break;
> > >  case 5: s += "[RAM Disk]"; break;
> > >   }

> > >     s += " - ";

> > >     if (x.DriveType == 3)
> > >       n = x.ShareName;
> > >     else if (x.IsReady)
> > >       n = x.VolumeName;
> > >     else
> > >       n = "[Drive not ready]";

> > >     s +=  n + "<br>";
> > >   }
> > >   document.write(s);
> > > }

> > > </SCRIPT>
> > > </HEAD>
> > > <BODY>
> > > Your drive info: <BR>
> > > <SCRIPT>
> > > ShowDriveList();
> > > </SCRIPT>
> > > </BODY>
> > > </HTML>



Sat, 17 May 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. next available drive letter

2. Retrieving drive letters and paths on a CD using client side VBScript

3. Set/Change CD-ROM drive letter with VBS

4. drive letter

5. Change CDROM drive letter via vbscript?

6. FileExist not working on all drive letters

7. Converting a network share spec into a path with drive letter

8. Change Drive Letter

9. change Drive Letter

10. CD-Rom Drive Letter

11. Change CD-ROM Drive Letter

12. Substituting Drive Letters

 

 
Powered by phpBB® Forum Software