Results 1 to 4 of 4

Thread: Writting in a file with javascript

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    1
      0  

    Default Unanswered: Writting in a file with javascript

    SALAM all.
    i'm programming a mobile app with sencha touch, and i need to save some information in a file (saved in the phone). I try this code which allows to write a file.txt with javascript but it doesn't work.

    Code:
    {
                xtype: 'button',
                flex: 1,
                margin: 10, 
                text: 'Confirmer', 
                handler: function()
                 {
                   Ext.Msg.confirm("Confirmation","Recharge de "+Ext.getCmp('num').getValue()+" Montant "+Ext.getCmp
    
    
    ('amount').getValue(),function(btn, text){
                    
            if (btn == 'yes')
             {
            Ext.getCmp('resp').setValue("Recharge effectue");
            var file = new ActiveXObject("Scripting.FileSystemObject");
            var a = file.CreateTextFile("c:\\testfile.txt", true);
            a.WriteLine("SALAM WORLD !");
            a.Close();
             } 
             else 
             {
            Ext.getCmp('resp').setValue("Recharge annule");
             }
            
    });
             //   Ext.getCmp('resp').setValue(btn); 
                 }    
            
               },

    have you any idea how can i save few data of my mobile app in the phone for using it later.
    thank you

  2. #2
    Sencha User AkashSaikia's Avatar
    Join Date
    Oct 2011
    Location
    Mumbai, India
    Posts
    33
    Answers
    1
    Vote Rating
    0
      0  

    Default

    Not sure exactly about the file reading and writing operations you have done is correct or not.
    Why dont you try HTML's Localstorage that is supported by sencha or you can use cookies(better is localstorage).

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    1
      0  

    Default

    SALAM.
    thank you AKASH for your response. the wiritting function is correct, i show it in many web site. But i will test with the HTML localstorage.
    thank you

  4. #4
    Sencha User AkashSaikia's Avatar
    Join Date
    Oct 2011
    Location
    Mumbai, India
    Posts
    33
    Answers
    1
    Vote Rating
    0
      0  

    Default

    plesure

Tags for this Thread

Posting Permissions

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