Andromo - Start Making Apps - Free Signup

Announcement

Collapse

New Forum Software

If you're here, you've found the new home for our forums. There will be some bugs to iron out, so thanks for your patience...
See more
See less

how to save variables in text file???

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to save variables in text file???

    Hi can anyone help with an idea for this...

    I have a project where the user can save and load a profile.
    the profile is to consist of different things:
    answered questions, menu settings and time the program have been used.

    I can set all this in run time, I can load a file and save a file.

    But how do i save all these different things in a file that i can load for next time I use the app.?

    I can get the ams app to save the variables one by one in the text file, but I cant work out how to load them again so that they work...

    Jonas DK

  • #2
    hi. The easiest is probably to use a table. As for restoring the data just create an arbitrary data grid, i.e.

    item #1 = First Name
    item #2 = Last Name
    item #3 = Font Color
    item #4 = Font Face
    item #5 = Start Page

    And so forth. You can write the table to a text file using the TextFile.WriteFromTable action, and you can read it back in using the TextFile.ReadToTable action. Restoring values is simply a matter of walking through your data and acting on each entry accordingly. :yes

    Comment


    • #3
      Originally posted by Corey
      hi. The easiest is probably to use a table. As for restoring the data just create an arbitrary data grid, i.e.

      item #1 = First Name
      item #2 = Last Name
      item #3 = Font Color
      item #4 = Font Face
      item #5 = Start Page

      And so forth. You can write the table to a text file using the TextFile.WriteFromTable action, and you can read it back in using the TextFile.ReadToTable action. Restoring values is simply a matter of walking through your data and acting on each entry accordingly. :yes
      Sorry Corey
      but Im a bit dumb when it comes to this, I am not a programmer but I have learnt to control a lot of the functionallety in AMS but I'm afraid that it has been a very long time since I last used it, so what you are saying makes as good as no sence to me..

      would it bee to much to ask to have it cut out in big shine letters, so even a preschool student could understand. I looked in the help files under tables but that is just as cryptic, the thing is if I can just see the funtionallety i can get it to make sence.. if you understand what I mean...

      cheers,
      Jonas DK

      Comment


      • #4
        Hi. Sorry, I don't have time this week to build it for you but I'll be happy to assist you build your own. It's not that hard once you get in there and start messing around with the code. Give it a shot and let us know whenever you come across any specific obstacles and we'll help you through them.

        Comment


        • #5
          Originally posted by Corey
          Hi. Sorry, I don't have time this week to build it for you but I'll be happy to assist you build your own. It's not that hard once you get in there and start messing around with the code. Give it a shot and let us know whenever you come across any specific obstacles and we'll help you through them.
          Hi Corey
          Thanks. I dident mean for you to build it for me. I just wantet some poiters on how to get going with the tables. If i see the bit in action I can figure out the rest.

          I tried to set it up from one of the templates I've attached it here, in cluded the xml quiz example (witch is why I ask if you could replace the test with png's..) the text is in danish but I think you can get the idea.

          Student create a profile on first start up that will remember what they have been through so they can take tests acordingly.
          nice...

          But I'll try fidling about with the tables and when I think I got it I'll post the code..

          cheers for the help,
          Jonas DK
          Attached Files

          Comment


          • #6
            Hi, for a great introduction to Tables click on "- Tables : An Easy Explanation [8:12] (Click here to view this video now!)" on this page:
            http://speedytraining.com/site/cd3.php

            Comment


            • #7
              Originally posted by Corey
              Hi, for a great introduction to Tables click on "- Tables : An Easy Explanation [8:12] (Click here to view this video now!)" on this page:
              http://speedytraining.com/site/cd3.php
              fantastic... that was exactly the push I needed... thanks Corey

              Isent it posible to get the training videoes by email dilivery like ams?
              I can only see an option to buy the cd set, but that takes ages to get to me....



              Jonas DK

              Comment


              • #8
                Hi. No sorry there isn't an ESD option available for the 5.0 CDs. The new training videos will be downloadable, but it's going to be a few months until there are the same number of training videos available for 6.0 as there are for 5.0. I'll be putting them out one module at a time starting pretty soon. FWIW Most of the stuff on the 5.0 CDs is directly applicable to 6.0, especially all the stuff on scripting. :yes

                Comment


                • #9
                  cool
                  I now have this in my page on.show
                  PHP Code:
                  Profile = {Name="John"test2="test3"test3="end"}; 
                  And on the projects on.menu I have this

                  PHP Code:
                  ....
                  elseif 
                  e_ID == 103 then
                  HomeFolder 
                  Shell.GetFolder(SHF_MYDOCUMENTS);
                  strName Dialog.Input("Navn""Skriv dit Navn""JaneDoe"MB_ICONINFORMATION);
                  strFolder Dialog.FolderBrowse("Hvor skal din profil gemmes?"""..HomeFolder);
                  TextFile.WriteFromTable(strFolder.."\\"..strName..".ele"Profile(), false);
                  .... 
                  But when I try to run it... when i Save i get an error telling me Im trying to call a Global Profile (table)

                  What did I mis?

                  (btw It would be nice if the forum CODE box colour coded like the PHP one does...)
                  Jonas DK
                  Attached Files

                  Comment


                  • #10
                    Originally posted by Jonas DK
                    I can only see an option to buy the cd set, but that takes ages to get to me....
                    “ages” might be equal to 8,640 min.

                    Look at this thread posts #22 & 24

                    Comment


                    • #11
                      Originally posted by csd214
                      “ages” might be equal to 8,640 min.

                      Look at this thread posts #22 & 24
                      We shall see... I just ordered the set CD's this morning (local time)

                      Comment


                      • #12
                        Thanks for the support, I hope you find lots of value in them.

                        Comment


                        • #13
                          Originally posted by Corey
                          Thanks for the support, I hope you find lots of value in them.
                          well if the rest is as good as the one you showed me... I wouldent expect less...

                          Comment


                          • #14
                            So now I have created the table but I keep getting an error trying to save it to file....
                            PHP Code:
                            elseif e_ID == 103 then
                            HomeFolder 
                            Shell.GetFolder(SHF_MYDOCUMENTS);
                            student.name Dialog.Input("Navn""Skriv dit Navn""JaneDoe"MB_ICONINFORMATION);
                            student.folder Dialog.FolderBrowse("Hvor skal din profil gemmes?"""..HomeFolder);
                            TextFile.WriteFromTable(student.folder.."\\"..student.name..".ele"student(), false); 
                            something about the table not being defind right... see attached error

                            is it something about not defining the indevidual strings in the table?
                            Attached Files

                            Comment


                            • #15
                              Hi. Try adding this before your code and see if it works:

                              student={};

                              :yes

                              Comment

                              Working...
                              X