Announcement

Collapse
No announcement yet.

Utility to create AMS Script to set Variables to ""

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

  • Utility to create AMS Script to set Variables to ""

    I'm not sure about the rest of you, but sometimes I lose track of the variables that I have set and used. I wrote this little VB app to create the AMS Action Script to set all the variables in a project to "".

    To use it. Save your project, and then drag your AM4 file onto the app, drop it, and it will put the script on the clipboard ready to paste into your project.

    As I said, it is a VB app, and I didn't create an install. You will need the VB6 runtimes. Most systems have it already, but if you don't, you can download them here.

    If you're interested, the utility is here.

  • #2
    Re: Utility to create AMS Script to set Variables to ""

    Wow! Cool stuff...

    Corey Milner
    Creative Director, Indigo Rose Software

    Comment


    • #3
      Re: Utility to create AMS Script to set Variables to ""

      Worm,
      I've heard people asking about such a thing, so I'm sure you've made some people happy. What would be a particular time that this would come in handy? The variables are all reset after the AMS program is shut down anyway aren't they?
      Just wondering....might save me some time in the future.

      Comment


      • #4
        Re: Utility to create AMS Script to set Variables to ""

        I mainly have used it to get all the variables I have in a project and put them in the initialize event to set them to a default value. After I paste it in, I can edit the line to put in an initial value. It beats trying to remember all the variables I've used.

        I'm not real sure where you'd use the code generated within a running app.

        Comment


        • #5
          Re: Utility to create AMS Script to set Variables to ""

          Here's one situation where this would be useful...

          I created a wizard program withing AMS that generates a different finished AMS product.

          A user selects a few options in the wizard and then clicks "start" and it builds the product.

          To do so it uses about 50 variables but if you build the product wrong in the wizard the first time and you would click "Start" again to rebuild the project. In order for this to work you would want the variables used to revert back to a default state as if you just launched the wizard program.

          Too bad this has VB dependencies but still very cool!

          Comment


          • #6
            Re: Utility to create AMS Script to set Variables to ""

            Before there is too much misconception...

            This utility is for use at DESIGN time.
            It doesn't reset the variables in your compiled/running app. It merely creates the code to set all variables to "". You can then paste the code into any Action you want within AMS.

            As for the VB dependencies, it isn't ran on your end-user's machine so there shouldn't be any issues. If YOU want to run the utility, YOU need the VB6 runtimes.

            I could put it in a Install Package with my handy-dandy copy of Setup Factory (LOVE IT!), but it's hardly worth it. There are no other dependencies, and most machines have the VB6 runtimes anyway.

            Comment


            • #7
              Re: Utility to create AMS Script to set Variables to ""

              No you wouldn't need to reset them kpsmith since the people would be re-choosing the values upon restart and therefore they would get "reset" by virtue of overwriting.

              My personal take is that I can't imagine a need for such a function but that it's cool anyhow. I can't figure why someone would need to reset all variables, and I notice no major programming languages seem to have a function specifically for this that I've seen which leads me to believe that it's not something most people would do.

              If you guys are thinking that clearing out a few variables will boost the performance of your apps, I doubt it. Having a few redundant variable values at this level probably doesn't chew up enough memory to justify clearing them out during runtime.

              As to a solution to "losing track" of your variables, I usually use global lists, especially if I am going to be juggling a few dozen variable/value sets. In this case it's easy to remove all the items from a global list with one action if you need to "reset all variables". Maybe global lists would solve some of you guy's scenarios, not sure... A global list is like an array though, and that's a much better solution for storing and managing lists of variables.

              Bottom line, whatever works...

              Corey Milner
              Creative Director, Indigo Rose Software

              Comment


              • #8
                Re: Utility to create AMS Script to set Variables to ""

                For me, it's a simple way to get all the variables in my app, and set them to an initial value for my projects init.

                Comment


                • #9
                  Re: Utility to create AMS Script to set Variables to ""

                  Oops,

                  Thanks Worm. After looking at it I see this utility is not what I thought it was. I was Wondering how you managed to reset all the variables in a running app. The answer is... you didn't.

                  Still cool, maybe I'll find a use for it...

                  In response to Corey's message...

                  Well, I wish it was that easy but only about 10 of the variables in the wizard are determined by user selection. The rest are intermediate variables that I use to store data to generate HTML pages or populate global lists.

                  You see, the main AMS .exe of the resulting product is the same for every project but the the .html pages and search indexes are all generated from a tab delimited spreadsheet using the wizard program.

                  It is all very cool. To your point though not every variable needs to be reset only 40 of the 10. So I just reset them individually after each succesful product generation.

                  I agree, it is pretty rare that you would need an AMS function to reset all the variables.

                  Comment


                  • #10
                    Re: Utility to create AMS Script to set Variables to ""

                    Your environment variables should be grabbed dynamically at runtime with each new build. Then you would never need to reset variables PLUS you can do way more cool stuff.

                    Grouping variables logically into global lists is best, i.e. one list for environmental variables, one for user settings, etc.

                    All my variables seem to automatically initialize themselves at runtime when I use AMS Worm, but hey if it works for you then great. I still think it's a very cool thing you have made.

                    Corey Milner
                    Creative Director, Indigo Rose Software

                    Comment


                    • #11
                      Re: Utility to create AMS Script to set Variables to ""

                      Hi Worm,

                      Neat little utility, things like this are the nice little bonuses that you get from having projects saved as XML files.

                      MSI Factory The Next Generation Intelligent Setup Builder

                      Comment

                      Working...
                      X