InstallerContactSite Map

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

  1. Launch File or Open URL
  2. Call a function from a standard dll
  3. Resolve Known Folders
  4. Installed .NET Assembly
  5. Close Application
  6. Detect Process
  7. Terminate Process
  8. Detect Service
  9. Check If User Exists
  10. Start Image Slideshow
  11. Stop Image Slideshow
  12. Message Box

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 and that page will be opened 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 executes the action, 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".

Call a function from a standard dll

This predefined custom action can be used to call a function from a dll. Unlike native dll custom action where the function you call 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 shown in the "Action Data" field).

ImportantCurrently, this custom action is 32-bit only, meaning it can not be used with 64-bit DLLs.

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. (eg. 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, drap-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”.

Installed .NET Assembly

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.

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.

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.

Close Application

This custom action allows you to close an application which uses an 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 shown, 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 titlebar, 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.

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.

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.

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.

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.

Start Image Slideshow

This custom action will start an image slideshow configured in the Image Slideshow page. Please note that the custom action is available only in an Enterprise 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.

Stop Image Slideshow

This custom action will stop an image slideshow configured in the Image Slideshow page. Please note that the custom action is available only in an Enterprise 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.

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