473,320 Members | 1,945 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,320 software developers and data experts.

A Question About FSOs !!

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.

Jul 23 '05 #1
3 2580
none wrote:
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. <script src="someFile.js"....> But it's irrelevant to your problem.
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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
Randy Webb wrote:
none wrote:
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.


No but I had my doubts !!
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


Mine just hangs !!

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. <script src="someFile.js"....> But it's irrelevant to your problem.
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.

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 !!
Jul 23 '05 #3
In article <41**********************@news.optusnet.com.au>,
"@(none)" <""mas\"@(none)"> wrote:

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...FileSystem.asp
http://www.javaworld.com/javaworld/j...pptowin32.html

Robert
Jul 23 '05 #4

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

Similar topics

1
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
8
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
5
by: eScrewDotCom | last post by:
www.eScrew.com eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is...
0
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
7
by: Edward Yang | last post by:
A few days ago I started a thread "I think C# is forcing us to write more (redundant) code" and got many replies (more than what I had expected). But after reading all the replies I think my...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.