Below is a description of the custom actions used in Advanced Installer.

1. Launch File or Open URL

This is a predefined attached custom action. It allows the launching of a file into execution or opening of a folder (the same action that occurs when you double-click it in Explorer).

You can also supply an URL to open a page in the default browser on the target computer. This action is performed by a program that comes with Advanced Installer, called viewer.exe.

Description of fields:

  • Source Path - this contains the file that will execute the actions, in this case viewer.exe. You don't need to change this field.
  • Source Type - this is the type of the file, in this case an EXE. You don't need to change this field.
  • Command Line - this is where you specify the file, the folder or URL to be opened. Since this is of Formatted Type you can use the [ Edit ] button to include a reference to a file, a folder or a property.

Syntax for the Command Line field:

[/dir <working_directory_path>] <file_to_launch> <parameters>

NoteYou can specify command line parameters that will be passed to the launched file.

Command Line Examples:

http://www.example.com

or

[#filekey] command line parameters

ImportantUsually, a file (or folder) path will contain spaces so you should include the file (folder) path within quotes, as follows:

"[#filekey]" command line parameters

There are often cases when you want to specify a working directory for the file you are launching, be it an EXE or a .bat and so on. This can be achieved by using the /dir option as follows:

/dir "C:\Program Files" [#MyFile.bat] param1 param2

This will set the current working directory to "C:\Program Files".

2. Launch File or Open URL Using a 64-bit Launcher

This predefined custom action has the same behavior as "Launch File or Open URL". In this case the files are launched using the 64-bit version of the viewer.exe program.

3. Call a function from a standard dll

This predefined custom action can be used to call a function from a dll file. Unlike native dll custom action where the called function must have a predefined signature, this custom action allows you to call a function with any signature. Use the Edit Function dialog to easily describe the signature of the function you want to call (the result will be showed in the "Action Data" field).

ImportantThe dll file from which the function is called must be included in the application files. You can do this in the Files and Folders Page by either adding it as a regular file or as a temporary file.

4. Call a function from a standard 64-bit dll

This custom action calls a function from a 64-bit dll file in the same way as "Call a function from a standard dll" does.

5. Add Network Location

This predefined custom action allows you to automatically add a new shortcut to a shared network resource on the machine that runs the installer. In case the network location shortcut was previously created on the target machine, the custom action will overwrite it.

  • "<Network location name>"
  • Specifies the name under which the network path will be displayed
  • "<Network path>"
  • Specifies the network path for which the shortcut will be created

NoteBoth parameters must be declared in order to successfully add the network location

Example:

"My Location" "\\Server\Shared"

6. Remove Network Location

This predefined custom action allows you to automatically delete an existent network location shortcut from the target machine. In case the network location shortcut doesn't exist this custom action will not make any modifications to the system.

  • "<Network location name>"
  • Specifies the name of the network location shortcut that will be deleted.

7. Resolve Known Folders

This predefined custom action can be used to resolve a property based folder to the path of a known folder in Windows Vista (or later operating systems).

ImportantOn an earlier Windows versions this predefined custom action will not be able to resolve any Known Folder, so you should condition the installation of all components in that folder, based on the OS version. (e.g. VersionNT >= 600)

In order to use this predefined custom action in your project, follow the steps below:

a) In the Install Parameters page, create a new public property (only upper-case letters in its name), for instance MY_VISTA_FOLDER_PROP.

b) Set the value of the property to a known folder GUID. The complete list of known folder constants can be found here. For instance, if the per-user folder FOLDERID_SavedGames ("%USERPROFILE%\Saved Games") is required, you will set the value of the property to the following GUID:

{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}

c) In the Files and Folders page create a new property based folder, specifying the property you have defined above. You can now add content to this property based folder.

d) The Resolve Known Folders predefined custom action can be added under any standard action before CostFinalize. We shall sequence it after AppSearch, for instance.

e) In the Custom Actions page, make sure that the AppSearch standard action is visible in the tree control under both InstallUISequence and InstallExecuteSequence. If it is not, use the “Show Standard Action” toolbar button or context-menu entry to make it visible.

f) Add the predefined Resolve Known Folders custom action under "InstallUISequence -> AppSearch".

g) Keeping the SHIFT key pressed, drag-and-drop the custom action in tree control, under "InstallExecuteSequence -> AppSearch". This will create a copy of the action in the InstallExecuteSequence.

h) For both instances of the custom action set the “Action Data” field to the name of the property you have defined in step 1 above (MY_VISTA_FOLDER_PROP in the example, NOT the formatted value [MY_VISTA_FOLDER_PROP]). You can add many properties separated by ; character.

i) Set the Scheduling Option for the custom action to “ Execute only once if present in both sequence tables”.

8. .NET Installer Class Action

This is a custom action that launches a .NET Assembly. The assembly must have a class that inherits the Installer class with the RunInstaller attribute set to true.

8.1 Assembly Target Platform

Custom actions are created and conditioned depending on your assembly target platform:

  • x86 - A single custom action will be created to run on any platform.
  • x64 - A single custom action will be created to run only on 64-bit platforms.
  • Any CPU - Two custom actions will be created and conditioned (one to run on 32-bit platforms and the other for 64-bit platforms)

You can also modify the execution conditions as desired.

8.2 Description of the fields:

  • Action Data - represents the parameters received by the assembly and can be edited using the Edit .NET Custom Action page.

NoteWhen you create a custom action under Install, Uninstall, Rollback or Commit tree items the Action parameter defaults to the correspondent method. You can change the Action parameter if you want other method to be called.

8.3 Debug the method of the .NET Installer Class Action

A quick way to Debug the .Net Installer Custom Action can be found here.

9. Close Application

This custom action allows you to close an application which uses a user Interface. It basically sends WM_CLOSE messages to all windows created by the application process.

After adding the custom action, in its Custom Action Properties page the Action Data field should be set to the name of the main EXE of your application. If this field is not showed, you can set the CustomActionData property to the EXE name before the custom action runs.

ImportantThis custom action closes the target application by sending WM_CLOSE messages to its windows. If this message is not treated by the application, it will not be closed.

By default the custom action closes windows which have a title-bar, a border and a system menu. If you want to specify custom style flags you can set the AI_CLOSEAPP_WINDOW_FLAGS property to the flags you want. For example, the property can be set to:

WS_SYSMENU | WS_OVERLAPPED | WS_VISIBLE

NoteModal windows are always ignored by the custom action. Also, custom flags should be used only when the default ones don't detect your application windows.

10. Detect Process

This custom action allows you to detect a running process on the target machine. For more details please see the Detect or stop a process How-To.

11. Terminate Process

This custom action allows you to stop a running process on the target machine. For more details please see the Detect or stop a process How-To.

12. Detect Service

This custom action allows you to detect a service on the target machine. For more details please see the Detect a service How-To.

13. Check If User Exists

This custom action allows you to check if a specific user account exists on the target machine or inside the installer. It was designed to work with the "LogonInformationDlg" dialog, but it can also be used separately. The custom action uses the following properties:

  • USER_NAME - this property needs to be set to the target user name
  • DOMAIN_NAME - this property needs to be set to the target user domain name
  • AI_USER_IGNORE_FULLNAME - if this property is set to 1, the custom action will search only user account names (profile names are ignored)
  • AI_USER_IGNORE_MSI - if this property is set to 1, the custom action will ignore user accounts configured inside the installer
  • AI_USER_EXISTS - after running the custom action this property will be set to Yes if the user account exists or to No otherwise

NoteUSER_NAME and DOMAIN_NAME are associated with the "User Name" and "Domain" edit controls on "LogonInformationDlg". After adding this dialog you can simply add the custom action as a DoAction published control event on its [ Next ] button.

ImportantThis custom action does not verify the user account password in order to maintain password security.

14. Start Image Slideshow

This custom action will start an image slideshow configured in the Slideshow page. Please note that the custom action requires at least an Enterprise or Architect project when using a custom trigger for the start option. Also, excepting the "Expression" field in the " Execution Condition" section, it is recommended to keep the default settings of the custom action.

15. Stop Image Slideshow

This custom action will stop an image slideshow configured in the Slideshow page. Please note that the custom action requires at least an Enterprise or Architect project when using a custom trigger for the stop option. Also, excepting the "Expression" field in the " Execution Condition" section, it is recommended to keep the default settings of the custom action.

16. Message Box

This custom action will display a message box. The Display a message box How-To explains the usage of this custom action.

Topics