How to launch a file after an installation
The following article uses options that are available starting with the Enterprise edition and project type.
For some installation packages you may want to launch a file or open a folder or a URL after the install process is finished.
1. The user can decide if the file will be launched
For this, you can follow these steps:
- Go to the Dialogs page and select "ExitDialog"
- Select the [ Finish ] button and select the Finish Actions tab in the "Control" section
- Enable the "Launch application at the end of the installation" option
- Select the file you want to launch
This method doesn't allow you to launch a URL or a folder, it allows you to launch files only.
1.1 Launch the file in a mixed package type
This approach can be used in a mixed package type when the application is conditionally installed, based on the machine architecture. Instead of launching the application at the end of the installation, a property will be set with the path of the installed file.
To use this approach, you can follow the steps below:
- Go to the Install
Parameters page and create a
new property:
- Property: FILE_TO_LAUNCH
- Value: C:\
- Add a Set Installer property custom
action as a custom action with sequence scheduled after the "Paths
Resolution" stage, in the Wizard Dialogs Stage section.
Edit the custom action properties as follow:
- Property: FILE_TO_LAUNCH
- Value: [#myFile32bit.exe]
Condition the custom action execution through its "Condition" field. For this, we can take advantage of the VersionNT64 property. Since the 32-bit executable will be installed, we can add the NOT VersionNT64 as a condition.
- Add another Set Installer property custom
action as a custom action with sequence. Edit the custom action
properties as follow:
- Property: FILE_TO_LAUNCH
- Value: [#myFile64bit.exe]
Condition the custom action execution through its "Condition" field. Add the VersionNT64 as a condition.
- Go to the Dialogs page and select "ExitDialog"
- Select the [ Finish ] button and select the Finish Actions tab in the "Control" section
- enable the "Launch application at the end of the installation" option
- Select any file
The view does not support to select a property, but you can delete the current content and add the [FILE_TO_LAUNCH] in the Application field.
1.2 Custom approach to launch a file, folder or URL
To launch a file, folder or URL you can use a custom checkbox like this:
- Create a checkbox control on "ExitDialog"
- In the Properties section set the "Property Name" field to CHECK
- In the "Text" field set the text of the checkbox (for example "Launch the application")
- In the Custom Actions Page, add a "Launch file" or an "Open URL" custom action "without sequence"
- Add an "Execute custom action" published event on the [ Finish ] button that executes the "Launch file" or the "Open URL" custom action that you created
- Modify the "Execute custom action" control event's condition to use the property of the checkbox:
Execute custom action myapp.exe AI_INSTALL AND CHECK
This way, the custom action will only run if the checkbox is selected. If you want the checkbox to be selected by default, you can set any value in the "Default Value" field.
2. The user cannot decide if the file will be launched
For this you can use a custom action scheduled under the "Install Execution Stage" -> "Finish Execution" action group (you can use the "Launch file" custom action to launch a file or the "Open URL" custom action to open a URL). The custom action will have the "Condition" field in the "Execution Stage Condition" section set to "NOT Installed". In order to use the custom action you can follow the steps below:
- Go to the Custom Actions page
- Add a "Launch file" or an "Open URL" custom action after "Finish Execution" action group
- Set the "File To Launch" field to the path of the file or folder you want to open (you can also set a URL if you use the "Open URL" custom action)
- Set the "Condition" field in the "Execution Stage Condition" section to (Not Installed)
With this method, the file, folder or URL will be launched when the install process is complete (when "ExitDialog" is displayed).
If the installation will run on Windows Vista or above, the custom action should be moved under "Install Execution Stage" -> "Add Resources". Also, it should be set as "deferred" with "no impersonation".
2.1 Run a custom action on “Finish” dialog
If you want to launch the file when the user clicks the
button on "ExitDialog" you can follow these steps:- Make sure you are using at least an Enterprise or Architect project (you can change the project type using the Project -> Options menu)
- Go to "Dialogs" page and select "ExitDialog"
- Select the Finish Actions tab
- Enable the "Launch application" option for the file you want to launch
- Make sure that the Checked by default option is set
- Select the "Launch Your Application" text control and set the "Visible" flag to "False" in its Properties pane
- Do the same for the checkbox control