Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > A Question About FSOs !!

Reply
Thread Tools

A Question About FSOs !!

 
 
@(none)
Guest
Posts: n/a
 
      01-08-2005
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.

 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      01-08-2005
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
 
Reply With Quote
 
 
 
 
@(none)
Guest
Posts: n/a
 
      01-08-2005
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 !!
 
Reply With Quote
 
Robert
Guest
Posts: n/a
 
      01-08-2005
In article <41df464f$0$5383$(E-Mail Removed)>,
"@(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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
question row filter (more of sql query question) =?Utf-8?B?YW5kcmV3MDA3?= ASP .Net 2 10-06-2005 01:07 PM
Quick Question - Newby Question =?Utf-8?B?UnlhbiBTbWl0aA==?= ASP .Net 4 02-16-2005 11:59 AM
Question on Transcender Question :-) eddiec MCSE 6 05-20-2004 06:59 AM
Question re: features of the 831 router (also a 924 question) Wayne Cisco 0 03-02-2004 07:57 PM
Syntax Question - Novice Question sean ASP .Net 1 10-20-2003 12:18 PM



Advertisments