Announcement

Collapse
No announcement yet.

Conditional install

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

  • Conditional install

    Hello

    I am trying to allow users to choose their location and language before installing our application.

    I do this by using a combo boxes screen...

    2 choices, language and region...

    Variables are %Combo01% and %Combo02%

    On Combo01 = Spanish I want to install a group of files... on Combo01 = Polish another group of files etc....

    Under conditions for each of the files I am doing this:

    %Combo01% == Spanish

    And for region

    %Combo02% == Europe

    But I am getting an error during install...

    Any suggestions?

    Thanks

  • #2
    The script condition needs to be properly written, without syntax errors, and evaluate to true or false. You need to expand session variables, and place quotes around strings, in the same manner as you would need to do if this comparison was part of any script.

    Ulrich

    Comment


    • #3
      Hi.

      I'm a little confused...

      The example in the documentation says:


      my_variable == "Custom"

      This means if the string value of the varibale "my_variable" equals the string "Custom", install the file. If the strings are not equal, the file will not be installed.

      So, if my variable is %Combo02% ( a session var), then SessionVar.Expand("%Combo02%") == "Europe" should install that file provided the user selects Europe, right?

      I tried this and whilst I get no errors the file I am trying to install does not install...

      What am I missing?

      Comment


      • #4
        So, following my instructions, you eliminated the runtime error reported in your first post. You are welcome.

        Currently you appear to be facing an error in your logic, as you no longer get a runtime error, but the selected file(s) is/are still not deployed as you hoped. To address this, please attach the project file and the installation log file. You can add attachments to your post after clicking the "Go Advanced" button.

        Ulrich

        Comment


        • #5
          Hello Ulrich

          Sorry, yes, thank you.

          Attached is my project file...

          I am sure I am missing something simple.. but not sure what.

          It is actually an SF7 file... not SF9 and the file I am attempting to conditionally install is called Game.set

          Thanks
          Attached Files

          Comment


          • #6
            A few things to consider:
            1. The name of the session variables must be unique. In order to make sure that the session variable isn't used anywhere else in the installer, I recommend that you give them custom names, for example "%Language%" instead of the default "%Combo01%", and "%Region%" instead of "%Combo02%".

            2. The session variables of the Combo Boxes are not set in Setup Factory unless the user actually makes a selection. This means that, if the user just clicks Next without selecting an item from the combo box, the session variable of that control won't be set, unless you define the default value previously in the On Preload script, or make a selection of the Combo via code. One method is this:
              Code:
              -- These actions are performed before the screen is shown.
              -- set default values
              SessionVar.Set("%Language%", "Spanish");
              SessionVar.Set("%Region%", "Europe");
            3. Use the installation log file as a debugging aid. Place something like this into the On Next script of the screen with the combo boxes:
              Code:
              -- These actions are performed when the Next button is clicked.
              -- Tip: this is where you could add actions to validate the
              --      user's input before proceeding
              
              -- log the user's input
              SetupData.WriteToLogFile(SessionVar.Expand("Info\tUser selection: %Language%, %Region%\r\n"), true);
              
              -- advance to the next screen
              Screen.Next();
            4. Although there is nothing wrong with the way you are setting the script condition, there is something you should be aware about (and which you would easily see with the debugging code mentioned in the former item): The string shown in the combo depends on the language detected in the regional settings. You can't compare a string with "Europe" when the only options in the combo are "Roca", "Papel" and "Tijeras", as you have in the Spanish version of the screen, for example. The better approach would be using the selected indexes (a number) in the condition, or perhaps making the language-dependent files part of packages, and select the required package for installation in the On Next event, not installing those files which are part of other packages (and languages).


            Ulrich

            Comment


            • #7
              Thank you..

              This now works as expected, but I have another question....

              How do I show or not show one of the combo boxes choises based on a session variable..

              So, I have a first screen that asks a user to choose their region.. then a second screen that asks them to choose their language..

              How can I only show languages where a specific region has been chosen....

              For example, my first screen allows them to choose either Europe or Latin America

              If they choose Europe I want to show all 3 languages available in my next page... but if they choose Latin America I only want to show 2 of those languages?

              Thanks

              Comment


              • #8
                If you want to offer options based on previous input, then you need to populate the options in the combo box dynamically, at runtime. There are actions such as DlgComboBox.SetProperties(), DlgComboBox.AddItem() and more to control combo boxes during the execution of your setup.

                The attached project will show different options in the second combo, based on the selection made in the first one. As you can change the options at runtime, there is no need for a second dialog as you mentioned.

                Ulrich

                PS: Once you acknowledge that this works, this thread will be moved to the Setup Factory 7 forum, where it belongs. Are you sure that it doesn't make sense to upgrade, so you can support current operating systems?
                Attached Files

                Comment


                • #9
                  Hi Ulrich

                  In your example I do not see the second drop down box during preview, even after selecting a region?

                  I have also added your code to my project, but the result is the same during preview...

                  As for upgrading, it is something we are considering at the moment...

                  Thanks

                  Comment


                  • #10
                    You won't see the combo in preview, as no scripts are executed. You need to build the project and run it to see it in action.

                    Ulrich

                    Comment


                    • #11
                      Hi Ulrich...

                      I am still having some issues...

                      I have tried defaulting to Europe so that the lower menu is shown right away, but it does not work. I have to click on Latin America and then back on Europe to see the lower menu...

                      I have also added a language check so that if the primary language is X I show localised options for the menu choices... but this also does not seem to work...

                      I am attaching my project file again so perhaps you could take a look...

                      Thanks
                      Attached Files

                      Comment


                      • #12
                        I have revised your project again, and made additional changes. You need to translate the language selection screen, and all the elements in the two combo boxes, for all languages you support, so their contents are shown properly when the screen is first loaded. Afterwards you can change the content of the lower combo box based on the selection made in the upper one, via scripting.

                        Please build the attached project, and run the installer so you can see the behavior of the first screen. You will need to test this setup on Windows set to English, Portuguese, Spanish and Polish regional settings, or use Application.SetInstallLanguage() to see the different screens/translations.

                        Ulrich
                        Attached Files

                        Comment


                        • #13
                          Hi Ulrich

                          I am almost there but still seem to have one issue...

                          I have added prompts to force the user to select a region and language rather than let them just use the defaults and this is all working, and everything is now localised depening on the install language and choice of region...

                          But when a user starts the installer and their windows language is Polish, the installer does not start in Polish...

                          Any ideas?

                          My latest project file is attached..

                          It does seem to work if I manually set the install language for testing though

                          Any thoughts?

                          Thanks
                          Attached Files

                          Comment


                          • #14
                            But when a user starts the installer and their windows language is Polish, the installer does not start in Polish...
                            Any ideas?
                            The install language selected in Setup Factory is controlled by the "Language for non-Unicode programs" in the Control Panel, not by the display (interface) language. I have published a plugin to retrieve the display language, if you want to use that instead.

                            Ulrich

                            Comment


                            • #15
                              Hi Ulrich

                              Which version of this do I install.. and then how do I use it?

                              Thanks

                              Martyn

                              Comment

                              Working...
                              X