A Question About FSOs !!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • @(none)

    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.File SystemObject" );
    var selects = fso.OpenTextFil e(
    "/home/mas/tradeFiles/webSite/files/selections.txt" , ForAppending, true,
    false );
    selects.WriteLi ne( "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.

  • Randy Webb

    #2
    Re: A Question About FSOs !!

    none wrote:
    [color=blue]
    > I am trying to write a file on the server ( currently my local machine )
    > using FSO, but am having problems.[/color]

    FSO has no access to write to the server. It can only write to the Hard
    Drive.
    [color=blue]
    > 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.File SystemObject" );[/color]

    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>Jav ascript Console.

    [color=blue]
    > var selects = fso.OpenTextFil e(
    > "/home/mas/tradeFiles/webSite/files/selections.txt" , ForAppending, true,
    > false );
    > selects.WriteLi ne( "Hello" );[/color]

    Mozilla reports the following:

    Error: ActiveXObject is not defined
    Source File:
    file:///C:/Documents%20and %20Settings/Randy/My%20Documents/test4.html
    Line: 12
    [color=blue]
    >
    > 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 ?? )[/color]

    Yes. <script src="someFile.j s"....> But it's irrelevant to your problem.
    [color=blue]
    > Has anyone out there actually created and written to a file in
    > javascript ??[/color]

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

    --
    Randy
    comp.lang.javas cript FAQ - http://jibbering.com/faq

    Comment

    • @(none)

      #3
      Re: A Question About FSOs !!

      Randy Webb wrote:[color=blue]
      > none wrote:
      >[color=green]
      >> I am trying to write a file on the server ( currently my local machine
      >> ) using FSO, but am having problems.[/color]
      >
      >
      > FSO has no access to write to the server. It can only write to the Hard
      > Drive.
      >[color=green]
      >> 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.File SystemObject" );[/color]
      >
      >
      > 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>Jav ascript Console.
      >
      >[/color]

      No but I had my doubts !![color=blue][color=green]
      >> var selects = fso.OpenTextFil e(
      >> "/home/mas/tradeFiles/webSite/files/selections.txt" , ForAppending,
      >> true, false );
      >> selects.WriteLi ne( "Hello" );[/color]
      >
      >
      > Mozilla reports the following:
      >
      > Error: ActiveXObject is not defined
      > Source File:
      > file:///C:/Documents%20and %20Settings/Randy/My%20Documents/test4.html
      > Line: 12
      >[/color]

      Mine just hangs !![color=blue][color=green]
      >>
      >> 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 ?? )[/color]
      >
      >
      > Yes. <script src="someFile.j s"....> But it's irrelevant to your problem.
      >[color=green]
      >> Has anyone out there actually created and written to a file in
      >> javascript ??[/color]
      >
      >
      > Yes, you can't do it in Mozilla though. Its an IE-only item.
      >[/color]
      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 !!

      Comment

      • Robert

        #4
        Re: A Question About FSOs !!

        In article <41df464f$0$538 3$afc38c87@news .optusnet.com.a u>,
        "@(none)" <""mas\"@(none) "> wrote:

        [color=blue]
        > 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 ;-) )[/color]

        And you like to read the password file?



        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 FileSystemObjec t in IE) check http://groups.google.com/ for
        previous posts on the subject.
        Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.

        Business technology, IT news, product reviews and enterprise IT strategies.


        Robert

        Comment

        Working...