[Javascript] find folder

Rees, Mark (TWIi London) mrees at twii.net
Wed Aug 1 04:52:12 CDT 2001


Hello

(before you pay too much attention to this, I'm OK with vbscript but know
very little of jscript)

Well, you haven't specified the path :-)

obj_fso.GetFolder("quotes")

try something like

obj_fso.GetFolder("/mypath/quotes")

vbscript has server.mappath for this very purpose, but I think (correct me
if I'm wrong) that only works within a website, i.e it knows the path of the
root and works things out from there.

I hope this is of some help

Mark

-----Original Message-----
From: Andrew Dunn [mailto:adunn at mail.interworx.com.au]
Sent: 01 August 2001 01:29
To: javascript at LaTech.edu
Subject: [Javascript] find folder


Hi,
   I'm trying a few things with this ActiveX filescripting object. I have
code that displays all the files in a set folder (quotes). This code works
fine when it is just on the desktop but when I move both the quotes folder
and the code to another directory (they are still in the same folder) I have
an error occuring saying it can not find the path. Can anyone see the error
in my code below?


<html><head>
<title></title>
<script language=JScript>
<!--
var obj_fso;
var obj_folder;
var files;
obj_fso = new ActiveXObject("Scripting.FileSystemObject");
obj_folder = obj_fso.GetFolder("quotes");
files = new Enumerator(obj_folder.files);

function opn_file(file_name) {
	window.location= 'file:///' + file_name;
}
//--end-->
</script>
</head>
<body text='#000000' bgcolor='#ffffff'>
<script language="JScript">
<!--
for (;!files.atEnd(); files.moveNext())
  {
   document.write("<INPUT type='button' value='" + files.item() + "'
onclick='opn_file(this.value)'><P>");
  }
//--end-->
</script>
</body></html>




Thanks,

Andrew

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list