473,395 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

'Undefined' Error for "Scripting.FileSystemObject"

Hi -

I have code that automatically fills tabs on a page. In some cases, a
URL path won't be correct (the folder and files don't exist) and, in
these cases, I want to catch these exceptions and move the logic to
the next instance in the loop (again, testing if the URL path exists).

I have a check_path function for these cases with the following code:

var oFSO = new ActiveXObject("Scripting.FileSystemObject");

if (!oFSO.FolderExists(fold)) {
alert("Folder does not exist!");
}

else if (!oFSO.FileExists(file))
{
alert("File does not exist!");
}

The problem is that the first line keeps causing the logic to fail.
when i try/catch the code, I get an "undefined" error that seems
to come from the ActiveXObject("Scripting.FileSystemObject") part.

My Question(s) Is:

a) Is this the best way to test to see if a URL path exists in
javascript?
b) If it is, why does the oFSO = new ActiveXObject... part keep
throwing an 'undefined' error?

I thank you.

Mar 27 '07 #1
1 9361
VK
On Mar 27, 10:06 pm, "pbd22" <dush...@gmail.comwrote:
I have a check_path function for these cases with the following code:

var oFSO = new ActiveXObject("Scripting.FileSystemObject");
However obvious it may be:
You can get local file access this way only:
1) for lowest security level
2) only for IE

So if you are trying to use it for a web-page then it doesn't work.

If you are using it for local pages / custom security settings for IE
then the current security settings are still too high to use FSO: trop
them further down. For a test:

try {
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
}
catch (SecurityException) {
window.alert(SecurityException.message);
}

Mar 27 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lin Ma | last post by:
Greetings, Is it possbile to check a file exist without using Server.CreateObject("Scripting.FileSystemObject") in asp page?? The reason is our hosting company turn that function off for...
5
by: Andrew | last post by:
Hi, experts, My system has a problem when I invoke the fileSystemObject to create a text file (it worked ok long before.) The asp seems running, but actually never finishes. I don't know what I...
3
by: bt | last post by:
I am just beginning with asp and have gotten an error that I need some help with. I posted a pair of files to an online ASP host server. The files are in the same directory; one is readfile.asp...
2
by: Robin Tucker | last post by:
Hi there, Getting ready for deployment and I would like to be able to run an install script that will not just generate the schema, but fill in some of the tables with default data. Is there a...
2
by: Stavros | last post by:
Hi all when I execute the following VB6 code in Windows 2000 and as an Administrator, everything is working fine. Project->References->"Microsoft Scripting Runtime" and scrrun.dll is located...
4
by: MoF | last post by:
Hello! I have for a long time used the line: Set FS=Server.CreateObject("Scripting.FileSystemObject") in my ASP code. Suddenly one day this week it stopped working and I now get the error: ...
1
by: chsmith | last post by:
I'm calling a .net / c# .dll from .ASP via Server.CreateObject(). I regasm, gacutil /i and all runs fine on XP SP1 or older. SP2 registry subracts System (??) from the registry root nodes and...
3
by: =?Utf-8?B?VG9kZA==?= | last post by:
trying to access files located on another server within the network. the folder is shared out and we created a virtual directory as well. The error is Microsoft VBScript runtime error '800a004c'...
7
by: Benjamins via AccessMonster.com | last post by:
Hi, I have meet a problem for CreateObject("Scripting.FileSystemObject"). I uses this code to get the information of the harddisk I have 10 user using the same code. All where working fine...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.