A Question About FSOs !!

@

@(none)

I am trying to write a file on the server ( currently my local machine )
using FSO, but am having problems.

I have the following code ( which I got from several sources - mainly
http://sislands.com/coin70/week10/asp/fsobj.htm and have inserted this
both inside a function and outside.

var fso;
ForAppending = 8
fso = new ActiveXObject( "Scripting.FileSystemObject" );
var selects = fso_OpenTextFile(
"/home/mas/tradeFiles/webSite/files/selections.txt", ForAppending, true,
false );
selects.WriteLine( "Hello" );


Problem is as soon as it gets to the 4th line ( selects = fso...........
) the browser hangs. Isuspected there may be a setting in the browser
but this doesn't seem to be the problem ( Mozilla ), now I suspect
javascript may need some sort of include statement ( does it have such a
concept ?? )

Has anyone out there actually created and written to a file in
javascript ?? The two books I have don't even make reference to file
operations ( I know I'll get the O'Reilly book next week ;-) )

Hope someone can help !! Thanks.
 
R

Randy Webb

none said:
I am trying to write a file on the server ( currently my local machine )
using FSO, but am having problems.

FSO has no access to write to the server. It can only write to the Hard
Drive.
I have the following code ( which I got from several sources - mainly
http://sislands.com/coin70/week10/asp/fsobj.htm and have inserted this
both inside a function and outside.

var fso;
ForAppending = 8
fso = new ActiveXObject( "Scripting.FileSystemObject" );

Did the website tell you that Mozilla doesn't support ActiveXObject or
does it tell you to check Mozilla's JS Console? Tools>Web
Development>Javascript Console.

var selects = fso_OpenTextFile(
"/home/mas/tradeFiles/webSite/files/selections.txt", ForAppending, true,
false );
selects.WriteLine( "Hello" );

Mozilla reports the following:

Error: ActiveXObject is not defined
Source File:
file:///C:/Documents%20and%20Settings/Randy/My%20Documents/test4.html
Line: 12
Problem is as soon as it gets to the 4th line ( selects = fso...........
) the browser hangs. Isuspected there may be a setting in the browser
but this doesn't seem to be the problem ( Mozilla ), now I suspect
javascript may need some sort of include statement ( does it have such a
concept ?? )

Yes. said:
Has anyone out there actually created and written to a file in
javascript ??

Yes, you can't do it in Mozilla though. Its an IE-only item.
 
@

@(none)

Randy said:
FSO has no access to write to the server. It can only write to the Hard
Drive.



Did the website tell you that Mozilla doesn't support ActiveXObject or
does it tell you to check Mozilla's JS Console? Tools>Web
Development>Javascript Console.

No but I had my doubts !!
Mozilla reports the following:

Error: ActiveXObject is not defined
Source File:
file:///C:/Documents%20and%20Settings/Randy/My%20Documents/test4.html
Line: 12

Mine just hangs !!
Yes, you can't do it in Mozilla though. Its an IE-only item.
No there was nothing in any of the stuff about it being IE specific (
ActiceX ) but I did gather that JS was not file friendly o. Bit of a
bugger really but I suppose I can see the sense behind it.

Thanks for the answer !!
 
R

Robert

Has anyone out there actually created and written to a file in
javascript ?? The two books I have don't even make reference to file
operations ( I know I'll get the O'Reilly book next week ;-) )

And you like to read the password file?

http://www.jibbering.com/faq/#FAQ4_3

4.3 How can I access the client-side filesystem?

Security means that by default you can't. In a more restricted
enviroment, there are options (e.g. live connect to Java in NN, and
using FileSystemObject in IE) check http://groups.google.com/ for
previous posts on the subject.
http://msdn.microsoft.com/library/en-us/script56/html/jsobjFileSystem.asp
http://www.javaworld.com/javaworld/jw-10-1998/jw-10-apptowin32.html

Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top