21 Replies Latest reply on Aug 7, 2006 9:57 PM by Newsgroup_User

    Some questions on BudAPI

    wgb14 Level 1
      Hi all

      Two questions about budAPI:

      1) I wonder if there is any way to make two MIAW to appear on top of the stage window in a full screen mode. Currently my two MIAW disappear in a full screen mode but work fine when i uncheck this option

      2) I have the following script that write some data on the prefs.ini file

      baWriteIni("Performance","Time",""&the timer/60&"", the moviePath & "prefs.ini")
      baWriteIni("Question_asked","Questions",""&questions&"", the moviePath& "prefs.ini")

      I would like to expand this script to write the above data on a prefs.ini that will be unique for everytime that my application will run. For example, when the app rus for the first time to write the data on the prefs1.ini, the second time on the prefs2.ini, the third time on the prefs3.ini and so on.

      Do you have any ideas on how to do that?

      Any help will as always be appriciated

      Many thankis
        • 1. Re: Some questions on BudAPI
          Level 7
          > 1) I wonder if there is any way to make two MIAW to appear on top of the stage
          > window in a full screen mode. Currently my two MIAW disappear in a full screen
          > mode but work fine when i uncheck this option

          If you make your 2 windows #tool type, they will float on top

          > 2) I have the following script that write some data on the prefs.ini file
          >
          > baWriteIni("Performance","Time",""&the timer/60&"", the moviePath &
          > "prefs.ini")
          > baWriteIni("Question_asked","Questions",""&questions&"", the moviePath&
          > "prefs.ini")
          >
          > I would like to expand this script to write the above data on a prefs.ini that
          > will be unique for everytime that my application will run. For example, when
          > the app rus for the first time to write the data on the prefs1.ini, the second
          > time on the prefs2.ini, the third time on the prefs3.ini and so on.

          You will need to scan the folder you are placing you ini files in, grab
          the filename of the last file, make an integer of the last numerical
          part of it, add 1 to this and create a new prefs file.
          However, this is a lot of hoops to jump through. If your file was a
          list, saved with vList, you could use a single file and append to the
          list every time and write it back out to disk when appropriate. The
          read/write functions to an external file are free, but you won't be able
          to read it in a text editor.
          < http://www.updatestage.com/xtras/vlist.html>
          Or you could purchase a copy of Buddy File and do much the same thing
          with baReadList() and baWriteList()
          < http://www.mods.com.au>
          • 2. Re: Some questions on BudAPI
            JohnathonS Level 1
            and if you want to go with the new file each time in a numerical fashion, then you can go with the budapi command bafileexists to have the movie see if the file exists, and if it does, add one to the file name and try again and repeat until it finds a blank one. Also, you could set a pref that contains the last number used in the ini file (as in, in the same command that writes the ini, you could make it write the number that's attached to the prefs.ini) That way, if you want to write a new INI, you simply need read the pref file that contains the number and add one to it and create the ini (and then put that number in the pref mentioned before) I hope that makes sense... If not, I can make you a sample movie if you need me to.
            • 3. Some questions on BudAPI
              wgb14 Level 1
              Hi JohnathonS

              <<If not, I can make you a sample movie if you need me to.>>

              A demo movie would be great to demonstrate what you are saying.

              Thanks
              • 4. Re: Some questions on BudAPI
                wgb14 Level 1
                While waiting for the demo movie may i ask if anyone knows why my MIAWs disappear in a full screen mode of my application? The solution that Sean Wilson suggested (to make them tool) doesn't seem to work. Any ideas will be appriciated

                Many thanks
                • 5. Re: Some questions on BudAPI
                  Level 7
                  Which platform are you developing on and which Director version are you
                  using?
                  • 6. Re: Some questions on BudAPI
                    wgb14 Level 1
                    Hi

                    I am using MX2004 on Windows XP Profesional
                    • 7. Re: Some questions on BudAPI
                      Level 7
                      > I am using MX2004 on Windows XP Profesional

                      Are you testing as a projector? If so, I don't understand why your #tool
                      windows don't stay on top of your projector. Are you perhaps using Buddy
                      API to force the stage window on top?
                      • 8. Re: Some questions on BudAPI
                        Level 7
                        Is your stage window of type #tool too? If so, try making it a #document
                        window.
                        • 9. Re: Some questions on BudAPI
                          wgb14 Level 1
                          Yes, by making the MIAWs as tool and the stage as document works fine. Many thanks Sean. Now what about the first part of my question? JohnathonS offered to create a demo movie demonstrating his idea on how to accomplish what i want. Any idea where he may be?
                          • 10. Re: Some questions on BudAPI
                            wgb14 Level 1
                            Hi again

                            Any ideas on the second part of my problem? Please help

                            " I have the following script that write some data on the prefs.ini file

                            baWriteIni("Performance","Time",""&the timer/60&"", the moviePath & "prefs.ini")
                            baWriteIni("Question_asked","Questions",""&questions&"", the moviePath& "prefs.ini")

                            I would like to expand this script to write the above data on a prefs.ini that will be unique for everytime that my application will run. For example, when the app rus for the first time to write the data on the prefs1.ini, the second time on the prefs2.ini, the third time on the prefs3.ini and so on. "
                            • 11. Re: Some questions on BudAPI
                              Level 7
                              > Any ideas on the second part of my problem? Please help

                              Do you *have* to be able to read them in a text editor, or wil they only
                              be used by your projector?
                              If the latter, then it will be much easier to use vList like I suggested
                              earlier:
                              --
                              on mWritePrefs
                              vlXtra = xtra("vList").new(_movie.path & "prefs.ini")
                              tList = vlXtra.read()
                              lPrefs = [#performance: the timer/60, #question_asked: questions]
                              if listP(tList) then
                              tList.append(lPrefs)
                              else
                              tList = [lPrefs]
                              end if
                              OK = vlXtra.write()
                              if vList_error() <> 0 then
                              -- error occurred:
                              alert "Error writing prefs:" &RETURN& vList_errorString()
                              end if
                              vlXtra = VOID
                              end
                              • 12. Re: Some questions on BudAPI
                                wgb14 Level 1
                                Hi Sean

                                I tried your script but it says "OK = vlXtra.write() wrong number of parameters". Any idea wht is wrong?

                                Many thanks
                                • 13. Re: Some questions on BudAPI
                                  wgb14 Level 1
                                  There must be somethign wrong int eh forum today. I am getting th esame message multiple time!!!
                                  • 14. Some questions on BudAPI
                                    JohnathonS Level 1
                                    sorry about the wait, I got busy working on another project and didn't get a chance to check in again until now. Here's what I came up with: (Note: The only notable glitch I found is that it may cause a bit of lag after 800 or so login and logouts. Using the prefs one requires you to rely on a prefs file which is lost somewhere in the system when using Director MX2004, so that's the only downside to that. Both files are now included in the rar listed below. Enjoy!)

                                    http://files.mwogaming.net/filestore/iniwriter.rar
                                    • 15. Re: Some questions on BudAPI
                                      wgb14 Level 1
                                      Hi JohnathonS

                                      Your script does not seem to work. IS there anything that i am doing wrong?

                                      Many thanks
                                      • 16. Re: Some questions on BudAPI
                                        JohnathonS Level 1
                                        Hmm, make sure that Buddy API is included in the projector.. What exactly happens when you try to run the script?
                                        • 17. Re: Some questions on BudAPI
                                          wgb14 Level 1
                                          Hi

                                          I didn't know that it is working only in a projector mode. It is working fine. I need it for max 32 inis so i guess it would be OK.

                                          Many many thanks
                                          • 18. Re: Some questions on BudAPI
                                            JohnathonS Level 1
                                            No problem, has your other issue been resolved as well, or are you still looking for a solution to that one?
                                            • 19. Re: Some questions on BudAPI
                                              wgb14 Level 1
                                              The issue with the MIAW yes, i converted them into tools and they now work OK in projector mode. Just one quick question about the iniwrite file. You are saying:

                                              "Using the prefs one requires you to rely on a prefs file which is lost somewhere in the system when using Director MX2004,"

                                              What exactly do you mean with that?

                                              Many thanks again
                                              • 20. Re: Some questions on BudAPI
                                                JohnathonS Level 1
                                                IN Director MX2004 the prefs folder used in the getpref and setpref commands is burried in the user's computer somewhere (Exactly where I'm not sure) where as in older versions of Director the Prefs folder is in the same folder as the projector. It doesn't pose a problem unless the person were to try to copy a program with prefs folders from one system to another (because if they did it would lose the prefs file and overwriting of the ini files might occur)
                                                So as long as the program remains on the initial system that it's placed on, there's no problem with using the getpref setpref version.
                                                • 21. Re: Some questions on BudAPI
                                                  Level 7
                                                  Sorry, the dangers of email lingo:
                                                  OK = vlXtra.write( tList )