Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2012
    Posts
    80
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question about the Microsoft File System Object

    Hi All,

    I know you can have an FSO on a web pages opened in IE and do things.

    My question is. Is it possible to make the same FSO codes work when the web page is opened in Firefox.

    If no because of the ActiveX thing, can Firefox be made to mimic IE to get around that.


    Martin.
    Last edited by SpidersWebHelp; 11-08-2013 at 06:58 PM.

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,190
    Thanks
    10
    Thanked 569 Times in 550 Posts
    i think i wrote a shim for firefox about 5 years ago, but they've since changed their security settings and it no longer works. Still, FSO is a simple API and it shouldn't be too hard to replicate the important commands in an afternoon or two. You would need to package your code to comply with the newer security models You can also do the same for chrome using a "packaged app".

    If you only need to read, locally-opened pages can often use ajax to fetch sibling and child-level files.

    You can also use a file input in chrome to to load a whole deep folder; i've "uploaded" my entire MP3 folder (~120GB) into a single input before. Once in the input, you can easily iterate the folder structures using the files or entities collections.

    to recreate the whole FSO would be tedious, but smaller parts can be quite simple: what specifically are you needing to accomplish with FSO?
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  • #3
    New Coder
    Join Date
    Mar 2012
    Posts
    80
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Hi rnd me,

    The basic nuts and bolts is a form which can write a stock amount and the form is on a web page of course. Opened in IE all is fine and I have no problem writing to a file on the computer to add the changed quantity using the FSO below.

    So it is really the code below and how to make it do the same in Firefox as it does in IE.

    I have simplified the code to give the basics only. This code is all local to one computer, the web page opens on the computer and writes to files on that same computer, the code is not being used for general internet use. (The form which shows on the web page, it's code is not shown, does send a stock change to a host server for internet use and that is of no problem at all.)

    Code:
    <input id="Stock_Total" value="">
    
    <script>
    function SaveQty_ToComp() {
    
    var saveStockQty_fso = new ActiveXObject("Scripting.FileSystemObject");
    
    var saveStockQty_file = saveStockQty_fso.CreateTextFile("C:\\Document and Setting\\allthewayto\\qty.txt", true);
    
    var ProductQTYAmount=document.getElementById("Stock_Total").value;
    
    saveStockQty_file.WriteLine(ProductQTYAmount);
    
    saveStockQty_file.Close();
    
    saveStockQty_fso = null;
    }
    </script>

    Martin.

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,190
    Thanks
    10
    Thanked 569 Times in 550 Posts
    something like this can get the job done without too much extra human involvement. if you want to eliminate the file load part, it's going to get a lot more complicated and require a manifest.json file. maybe save that for version 2.0...

    anyway, this might get you started in chrome/firefox:

    Code:
    <label>Load report file to append: <input type=file onchange="loadText(this.files[0])" /></label>
    <script src="http://danml.com/js/download.js"></script>
    <script>
    
    var base="";
    function SaveQty_ToComp() {
       download( base+ document.getElementById("Stock_Total") +"\r\n" , "qty.txt", "text/plain");
    }
    
    function loadText(file){
      var fr=new FileReader();
      fr.onload=function(e){
        base=e.target.result;
      };
      fr.readAsText(file);
    }
    </script>
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •