Exercise 8.4 Managing Installer Flow Based on End-User Input

In many cases the path that an end-user will take through an installer depends on the choices made in different steps within the installation procedure. InstallAnywhere provides methods to gather input from end-users, which you can leverage to control your installation.

In this first example, we'll return to an action we added to our OfficeSuite installer, the Execute action added in the Post-Install task.

Generally, it's nice to ask the end-user if they would like to launch the application when the installation is complete. In order to add this functionality, we'll need both a method to ask if the end-user would like to launch the application and a method by which we can control that action.

In previous sections, we've seen the rules methods that can be used to prevent the installer from displaying certain panels, and we've learned a little about the InstallAnywhere variable architecture that is used to store information within the installer.

In this exercise, we'll put the two together in a useful manner.

Step One: Retrieving End-User Input

1.
Open the Post-Install task of the project.

Later we'll actually create some new projects, but for now we'll continue to use and abuse our OfficeSuite installer.

2.
Open the action palette and from the Panels tab, click Panel: Get User Input—Simple.

The Get User Input—Simple panel allows you to retrieve a single type of information from the end-user and store it in a single InstallAnywhere variable for later use. The panel allows input to be entered via text fields, choice menus, pop-up menus, radio buttons, or check boxes.

3.
Define and configure the panel.

a. In the Title field of the customizer for the Get User Input—Simple panel, enter “Launch.”

b. In the Prompt text field, enter “Would you like to Launch OfficeSuite?”

As we only want to ask a yes or no question, we'll utilize the Radio Buttons option as the input method.

c. Choose Radio Buttons from the pull-down menu on the middle right of the customizer.

Now, we'll configure the panel to present our options.

d. Click the Configure button, then click Add.

Clicking the Configure button will open a dialog where you can add labels for the buttons and set their default states.

e. A field will appear in the dialog. In the left-hand portion of the field, type your message. For this example, we'll use “Yes, launch OfficeSuite now.”

Make sure the word “Yes” is capitalized. The capitalization of the message is important because the string from the label will be stored exactly as you enter it in the Results variable—the variable that stores the results of the end-users input.

f.
Now click twice in the Default Value field to the right, then choose Selected.

4.
Create the “No” message for the panel.

a. Click Add.

b. In the Label column, enter “No, I'll open OfficeSuite later, thanks.”

Be sure that “No” is capitalized in your message.

c. Click Set Variable.

5.
Set the Results variable to $LAUNCH_APPLICATION$.

The default Results variable is $USER_INPUT_RESULTS$; however, you can change the variable to fit your needs or your naming scheme.

6.
Click the Preview button. You should see two radio buttons.

7.
Before continuing, make sure that you've placed the Get End-User Input panel in the post-install tree prior to the Execute Target File action.

Step Two: Applying the End-User's Choice

Now, to control the Execute Target File action we added earlier, we'll add a rule to that action. We want the action to occur only if the end-user has selected the Yes option. Because that information is stored in the variable we selected in the Get User Input—Simple panel, we'll use a Compare InstallAnywhere Variables rule.

1.
Add the Compare InstallAnywhere Variables rule by selecting the Execute Target File action and choosing the Rules tab from the customizer in the lower portion of the window.

Use Add Rule to add the Compare InstallAnywhere Variables rule. We'll add the following rule:

Install Only If:
Operand 1 Operand 2
$LAUNCH_APPLICATION$containsYes

If you used a variable other than $LAUNCH_APPLICATION$ in the Results variable in the Get User Input—Simple panel, use that variable here.

TIP

Although it is only strictly necessary when retrieving variables, using the $ notation when setting variables as well is a good idea. This makes it easier to keep variables and literal values straight.

2.
Rebuild and relaunch the installer.

You should be able to choose whether or not to launch the application. If the application launches, even when you've chosen No, check your rule to ensure that you are correctly comparing the variable and that the case of the value is correct.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.20.224.107