Building pages from script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Roboblue
    Forum Member
    • Dec 2003
    • 892

    Building pages from script

    What is the easiest way to take a design time built page, and build a script file that can be used to build it at run time?
    I want to build a catalog. To do separate pages would leave the project with over a 100 pages.
    I want to build each page in a project first, and be able to create that page at run time on a single page in any project.
    The only three objects that need to be created is a para (or two), label and an image from an image file.
    I know I can build the page using Page.Create.Object in the On preload Event script, then copy the script into a lua file. But that would entail building object properties tables manually.
    It would be much quicker to use design time to create the page, then export the page as a script or XML file.
    Page export from the menu will only create a file that can be used at design time.
    Here is an apz to show what I mean.
    I want to move the content (at run time) of the Display page to Page 1 by loading a script/xml file in the on preload event of Page 1.
    Any help would be appreciated.
    Attached Files
  • Dermot
    Indigo Rose Customer
    • Apr 2004
    • 1791

    #2
    You don't need to create a new page each time. You can do everything with just one page. Just load the paragraph text and image into the objects as needed. Ideally store all the info in a database. One record for each page in the catalog.
    Dermot

    I am so out of here :yes

    Comment

    • Roboblue
      Forum Member
      • Dec 2003
      • 892

      #3
      The problem is there may only be 1 para and an image on one page, three images and two paras and 3 labels on another. The image sizes change. the positioning of all the objects change. etc.
      To create objects on a page at run time requires a table of properties for each object to be in the script. Font, font size, dimensions, load a file or text, positioning, etc for just the paragraphs.
      These tables would have to be manually created in the On Preload script, then copied and pasted into a .lua file to be used in another project..
      Wouldn't it be simpler to build the page in design time, then export the script for each page to be used at run time? IF there's a way to do it? Especially for 100+ pages?

      If there was a way to create .lua or an .xml from the Page Export menu (page.xpg), that is what I am talking about. However, opening the .xpg in notepad is pretty useless.
      Last edited by Roboblue; 02-12-2008, 07:41 PM.

      Comment

      • Roboblue
        Forum Member
        • Dec 2003
        • 892

        #4
        So I take it that no one has had a need to export a design time created page that will be exported into a scirpt that can be used to build a page at run time?

        Comment

        • Dermot
          Indigo Rose Customer
          • Apr 2004
          • 1791

          #5
          There is no way to create pages at runtime. Based on what you said I think it would be easier to make a html page for each page of the catalog and then just have one page with a web object and load in the appropriate html file.
          Dermot

          I am so out of here :yes

          Comment

          • Roboblue
            Forum Member
            • Dec 2003
            • 892

            #6
            Thanx Dermot, that would be quicker, but not as interactive as a regular AMS page.

            I have put in a suggestion to add a feature that will either export the page as a script, or add an action to allow Runtime to use the .xpg.

            In the meantime, I have started working on a Page Builder.apz that will allow you to build a page in design time, then when previewed, will have menus to get the page, and object properties, which is in tables, singly or by enumerating the whole page, then putting the values of the tables into a lua file for that object, and then adding the objects as part of the whole page script. Then giving an option to zip all resource files into a directory structure that can be unzipped into another project later, or directly copy the files to another project, etc.
            All you have to do is set the project size to the one you are building pages for, then build the page then preview the project an click a few menus to get the script and files exported.
            It will be a fun project and when I'm done, I'll share it.
            I have already started and almost have the Para object template built. I will have to build a template for the page and all available objects tables, but only once.
            Anyway, I am sure I will be back for help later.

            Does anyone else think they could use this utility?

            Also, if anyone has already done a project like this, PLEASE share it before I spend days on this one.
            Last edited by Roboblue; 02-18-2008, 01:22 AM.

            Comment

            • holtgrewe
              Indigo Rose Customer
              • Jul 2002
              • 779

              #7
              Roboblue

              If this is way off-base from what you're trying to do, just ignore these ramblings.

              Looking at your example, it appears that you are on the right track.
              You should be able to extract the -<Page> ..</Page> XML set (which I see in your example).

              <Page>
              <Name>Display</Name>
              etc.
              </Page>

              Change the name
              <Name>Page1</Name>

              Add the new <Page> set and rewrite to an am7 file as many times as necessary, immediately after the <Page> set for the 'Display page.

              I tried this manually with Notepad and it seems to work okay - it would need to be tested of course.

              So without writing scripts per se, you should be able to manipulate the am7 file using TextFile or SQL commands, merging in the <Page> sets as necessary.

              hth

              Personally, I don't know if I'd ever have a need for a tool like this, but one never knows. Definately a fun project though.
              Last edited by holtgrewe; 02-18-2008, 07:56 PM.

              Comment

              • holtgrewe
                Indigo Rose Customer
                • Jul 2002
                • 779

                #8
                I should have included the apz with the last post.

                This was built with Notepad by copying the <page> sets and renaming the page name. Obviously, one could do this through AMS as well.

                Maybe this will fuel some ideas.
                Attached Files

                Comment

                • Roboblue
                  Forum Member
                  • Dec 2003
                  • 892

                  #9
                  I have already gotten a working partial system to write script from a page and export it.
                  I am using a database that is setup for each objects property table template. I then use object get properties, then step through the table and put each parameter into the database. Then I pull the text out of the database and write a text file that is saved as a lua.
                  This apz shows the same project except the Display page is now loaded from the script at run time. The script was mostly created from the utility, I just had to manually edit a couple of lines, but I'll fix that, later.
                  I have the templates setup for Para, Image, and label property tables. But will have all available objects and the Page done when I share the utility.
                  Maybe in two weeks, if I can get the time.
                  Attached Files

                  Comment

                  • Roboblue
                    Forum Member
                    • Dec 2003
                    • 892

                    #10
                    And yes, tis is a VERY ambitious project.
                    I have been away from AMS for several months and maybe this project will get me back up to speed.

                    Comment

                    • holtgrewe
                      Indigo Rose Customer
                      • Jul 2002
                      • 779

                      #11
                      Very nice. Looks like it will be a handy utility.

                      Comment

                      • Roboblue
                        Forum Member
                        • Dec 2003
                        • 892

                        #12
                        While building object templates, I realized that the plugins may be a problem.
                        EX: I use a shape plugin to draw the red border.
                        I could use a background image instead, but having the shape made me realize there's no build actions for plugins.
                        Now, the plugin could be built on the blank page in the project as 1x1 pixel, then run a script setting the dimensions and some other properties from the lua file. Or just set it not visible. It would work fine. Just not as elegant as building it from scratch on a blank page.
                        Is there a way to get the properties table for a plugin? (I don't think so)
                        I'll put up an example tomorrow.
                        Any ideas would be helpful.
                        Last edited by Roboblue; 02-18-2008, 10:41 PM.

                        Comment

                        • reteset
                          Indigo Rose Customer
                          • May 2006
                          • 1692

                          #13
                          nothing impossible :yes
                          an example from me
                          it uses xlm as database
                          Attached Files
                          amsplugins.com Is Closed.

                          Facebook Page

                          Comment

                          • holtgrewe
                            Indigo Rose Customer
                            • Jul 2002
                            • 779

                            #14
                            Amazing stuff.

                            You guys are light years ahead of me.

                            I'll stick to the AMS GUI however - I try to avoid the 'grunt' coding as much as possible. I don't want to make things more complicated than they need to be. lol

                            Comment

                            • Intrigued
                              Indigo Rose Customer
                              • Dec 2003
                              • 6138

                              #15
                              Originally posted by reteset View Post
                              nothing impossible :yes
                              an example from me
                              it uses xlm as database
                              Mirrored on amsuser.com:



                              Thanks reteset.
                              Intrigued

                              Comment

                              Working...
                              X