Global Lists and Build Time

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • TJ_Tigger
    Indigo Rose Customer
    • Sep 2002
    • 3159

    Global Lists and Build Time

    Is it possible to have a text file read into a Global list during build time?

    This is for a quizzing application and instead of importing the files myself, to make it more dynamic, I was wondering if I could have the files (test and answers) loaded into global lists upon build time. This way the whole test is stored in the global lists and not a disguised text file.

    Thanks
    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine
  • Brett
    Indigo Rose Staff Member
    • Jan 2000
    • 2000

    #2
    Re: Global Lists and Build Time

    You could do this by writing a VB program that interacts with AMS40 through it's COM interface or even by writing a VB script to interact with the document from within the product (see Tools | Macros).

    You can read more about the COM interfaces from the file "AMS40COM.chm" in your AMS40 folder. Basically you would make a script that reads the text file and then uses the AutoPlayGlobalList interface to create and fill some global lists and then the Document.Build function to build the app.

    Comment

    • Brett
      Indigo Rose Staff Member
      • Jan 2000
      • 2000

      #3
      Re: Global Lists and Build Time

      Here is some code to get you going:

      <pre>
      Sub Main
      strPath = GetFilePath(,"txt","","Locate Text File",0)
      If strPath = "" Then
      MsgBox "You must select a file."
      Exit Sub
      End If

      Dim g_list As AutoPlayGlobalList
      Set g_list = AddGlobalList(strPath)

      ' Read the file
      Open strPath For Input As #1
      While Not EOF(1)
      Line Input #1,L$
      g_list.AddItem(L$)
      Wend
      Close #1

      End Sub

      </pre>

      Just go to Tools > Macros and paste the above code in. Then run it. It will prompt you for a text file and then read it in line by line into a new global list with the same name as the text file. After you run it check out the Global Lists in your project.

      Comment

      • Corey
        Indigo Rose Staff Alumni
        • Aug 2002
        • 9741

        #4
        Re: Global Lists and Build Time

        You can indeed also use actions to read your text file into a tab delimited list and then insert theitems into a global list with a loop. Very simple, works great, that's how the quiz project on the new Powertips CD works. That way you can create convenient text "modules" to refresh the content, etc.

        Corey Milner
        Creative Director, Indigo Rose Software

        Comment

        • TJ_Tigger
          Indigo Rose Customer
          • Sep 2002
          • 3159

          #5
          Re: Global Lists and Build Time

          Are you doing this during Build time Corey? If you are, where are you placing the actions. I have AMS randomize the questions and answers from a txt file (conviently renamed) and put them in a global list so they can be read from there to the user. I will see what i can do to get them in during build time. I am wanting to do as you said with a quiz application where the modules could be rereshed.

          Can't wait to see your quiz application. My muddle brain code could use a lot of work.

          tigg
          TJ-Tigger
          "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
          "Draco dormiens nunquam titillandus."
          Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

          Comment

          • Corey
            Indigo Rose Staff Alumni
            • Aug 2002
            • 9741

            #6
            Re: Global Lists and Build Time

            Oh I see, I misunderstood.

            Corey Milner
            Creative Director, Indigo Rose Software

            Comment

            • Brett
              Indigo Rose Staff Member
              • Jan 2000
              • 2000

              #7
              Re: Global Lists and Build Time

              Tigger, the best and only way to do this is to use the VB macro method that I mentioned above. I just remembered this morning that you can actually automatically run a VB macro file every time you build. Just go to Project > Settings and select the Build tab. Go to the Pre/Post Build Steps section, check the Run before build option, select Macro file and specify your macro file that reads the text files to your global lists. This is exactly the kind of thing that the macro support is there for. See how far you can get on your own and let me know if you have any troubles. I will help you get this going.

              Comment

              • TJ_Tigger
                Indigo Rose Customer
                • Sep 2002
                • 3159

                #8
                Re: Global Lists and Build Time

                I will do so Brett thanks. I saw the prebuild optinos and figured it would be scripting that would be required in order do it pre-build. I will see what I can work out today.

                Tigg
                TJ-Tigger
                "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
                "Draco dormiens nunquam titillandus."
                Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

                Comment

                • TJ_Tigger
                  Indigo Rose Customer
                  • Sep 2002
                  • 3159

                  #9
                  Re: Global Lists and Build Time

                  One more thing, what language is this code in?
                  <font color=orange>
                  Sub Main
                  strPath = GetFilePath(,"txt","","Locate Text File",0)
                  If strPath = "" Then
                  MsgBox "You must select a file."
                  Exit Sub
                  End If

                  Dim g_list As AutoPlayGlobalList
                  Set g_list = AddGlobalList(strPath)

                  ' Read the file
                  Open strPath For Input As #1
                  While Not EOF(1)
                  Line Input #1,L$
                  g_list.AddItem(L$)
                  Wend
                  Close #1

                  End Sub
                  </font color=orange>
                  TJ-Tigger
                  "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
                  "Draco dormiens nunquam titillandus."
                  Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

                  Comment

                  • Lorne
                    Indigo Rose Staff Member
                    • Feb 2001
                    • 2729

                    #10
                    Re: Global Lists and Build Time

                    Looks like VB or VBA to me. (Visual Basic / Visual Basic for Applications)

                    AutoPlay actually uses an almost-VB language, that is roughly equivalent to VBA. (Has the same syntax, is missing a few obscure commands and features.)
                    --[[ Indigo Rose Software Developer ]]

                    Comment

                    • Brett
                      Indigo Rose Staff Member
                      • Jan 2000
                      • 2000

                      #11
                      Re: Global Lists and Build Time

                      Right. It is VERY close and almost completely compatible with VBA. We use the Sax Basic engine. Here is a comparison with VBA and VB Script: http://www.sax.net/activex/basic/features.aspx

                      The language is completely COM compatible. So, you could even store your questions and answers in an ADO-compatible database (like Access) and use ADO to query the database for your questions, etc.

                      Comment

                      • Bruce
                        Indigo Rose Customer
                        • Jun 2001
                        • 2133

                        #12
                        Re: Global Lists and Build Time

                        I have always wondered what language AMS used! I can sleep better now... :-)

                        Comment

                        • Worm
                          Indigo Rose Customer
                          • Jul 2002
                          • 3967

                          #13
                          Re: Global Lists and Build Time

                          Bruce, I'm sure AMS is written in C++, but the macro language within AMS is VB'ish. If AMS was written in VB, it would require run-times and would be useless as an autorun.

                          Comment

                          • Lorne
                            Indigo Rose Staff Member
                            • Feb 2001
                            • 2729

                            #14
                            Re: Global Lists and Build Time

                            Worm's right. AutoPlay itself is coded in C++. The design environment's COM automation uses SAX Basic, which is essentially VB. The run time, i.e. the stuff you build with AutoPlay, uses a proprietary set of actions and conditions that are entirely our own design.

                            In the future, expect some changes in many of these areas -- we're always looking for ways to make programming easier (or eliminate it completely) for those who are not comfortable with it...and also to make the programming environment friendlier and more powerful to those of us who dig that sort of thing.
                            --[[ Indigo Rose Software Developer ]]

                            Comment

                            • TJ_Tigger
                              Indigo Rose Customer
                              • Sep 2002
                              • 3159

                              #15
                              Re: Global Lists and Build Time

                              Just don't get rid of the progarmming interface for those who "dig" it. I like the concept of making it easier for those who are not used to programming, me included, but one thing that drew me to AMS is the power of the actions that one can put into the autorun.exe.

                              TJ-Tigger
                              "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
                              "Draco dormiens nunquam titillandus."
                              Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

                              Comment

                              Working...
                              X