Connecting Tech Pros Worldwide Forums | Help | Site Map

i want to find list of drives in local pc like c: ot d:, if anyone can know function

Newbie
 
Join Date: Jan 2008
Posts: 1
#1: Jan 18 '08
i have tried this javascript cod

<HTML>
<HEAD>

<script language=JavaScript>

function ShowAvailableDrives()
{
document.write(GetDriveList());
}

function GetDriveList()
{
var fso, s, n, e, x;
fso = new ActiveXObject("Scripting.FileSystemObject");
e = new Enumerator(fso.Drives);
s = "";
do
{
x = e.item();
s = s + x.DriveLetter;
s += ":- ";
if (x.DriveType == 3) n = x.ShareName;
else if (x.IsReady) n = x.VolumeName;
else n = "[Drive not ready]";
s += n + "<br>";
e.moveNext();
} while (!e.atEnd());

return(s);
}

</SCRIPT>
</HEAD>

<BODY>
<P>
<script language=JavaScript> ShowAvailableDrives(); </SCRIPT>
</P>
</BODY>
</HTML>

but it says that automation server can't create object in IE and in firefox it's not working. please tell me if you have any solutions.
dlite922's Avatar
Expert
 
Join Date: Dec 2007
Location: Moon, Dark Side
Posts: 1,095
#2: Jan 18 '08

re: i want to find list of drives in local pc like c: ot d:, if anyone can know function


Why is this a browser application?

You do know its Microsoft technology and will only work in IE?

Google(ActiveX)
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#3: Jan 18 '08

re: i want to find list of drives in local pc like c: ot d:, if anyone can know function


Quote:

Originally Posted by dlite922

Why is this a browser application?

You do know its Microsoft technology and will only work in IE?

Google(ActiveX)

And on another note: it might be better to ask in the javascript forum... i heard that's where they like to help with javascript?

:P
dlite922's Avatar
Expert
 
Join Date: Dec 2007
Location: Moon, Dark Side
Posts: 1,095
#4: Jan 19 '08

re: i want to find list of drives in local pc like c: ot d:, if anyone can know function


Quote:

Originally Posted by markusn00b

And on another note: it might be better to ask in the javascript forum... i heard that's where they like to help with javascript?

:P

Agreed. sorry i usually point this out myself (with even more sarcasim) , but that night i was switching back and forth too much.
Reply