We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

Lee Bornstein
Posts: 23
Joined: Sat Feb 11, 2006 5:44 am
Location: Las Vegas, NV
Contact: Website

Conditional Custom Action

How do I setup a Custom Action to run Conditionally?

Here's the situation...
My Installer Program (MyInstaller.msi) built with Advanced Installer needs to launch an external MSI (\PSQL\PsqlInstall.msi) if a Registry Value is NOT found.

All files are on CD in the following structure:
\MyInstaller.msi
\PSQL\PsqlInstall.msi

Installation of PsqlInstall.msi has to occur before the Exit Dialog appears in MyInstaller.msi.

Your help is appreciated.

Thanks,

Lee
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi Lee,

The recommended way to install other packages with your application is by using prerequisites:
http://www.advancedinstaller.com/user-g ... tware.html

However if you want to use a custom action then you need to schedule it under "InstallFinalize" ("Custom Actions" page) and use "Asynchronous execution, do not wait for return " as "Execution Properties".

As a custom action type you can use "Add Predefined Custom Action->Launch File or Open URL" and use "msiexec /i [SourceDir]PSQL\PsqlInstall.msi" as command line. You can specify the custom action condition in the "Execution Condition" field. For exemple you can use (NOT Installed) if you want to execute the custom action only your package in installed.

Let me know if you encounter any problems.

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
Lee Bornstein
Posts: 23
Joined: Sat Feb 11, 2006 5:44 am
Location: Las Vegas, NV
Contact: Website

GiGi:

Don't see InstallFinalize in Custom Actions.
Im running version 4.3 of installer.

All I see is...
InstallExecuteSequence
..Uninstall
..Rollback
..Install
..Commit

Am I looking in the right place?

Lee
Lee Bornstein
Posts: 23
Joined: Sat Feb 11, 2006 5:44 am
Location: Las Vegas, NV
Contact: Website

GiGi:

Found the InstallFinalize section of the installer you described -

added [SourceDir]Psql\Sample.exe

If I run the Installer, Sample.exe does execute as expected

If I then re-run the installer (same version) and do a Modify, Repair or Uninstall I get error "Windows cannot find the file Psql\Sample.exe"

If I then change Product Version Number, rebuild installer and Re-Install I get the error again (presumably during uninstall of previous version) then files are installed and my Sample.exe executes! Very confusing.

Here's my setup... Image

Error message does not show Drive Letter

Is there a reason that [SourceDir] is not defined at this time?
What can I do to insure [SourceDir] is valid.

Lee

Lee
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi Lee,

The SourceDir property is not available when uninstalling your package. To run the custom action only on install you can use (NOT Installed) as "Execution Condition". You can read more about Windows Installer SourceDir property here:
http://msdn2.microsoft.com/en-us/library/aa371857.aspx

Note that the recommended way to install other packages required by your application is by using prerequisites:
http://www.advancedinstaller.com/user-g ... tware.html

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
Lee Bornstein
Posts: 23
Joined: Sat Feb 11, 2006 5:44 am
Location: Las Vegas, NV
Contact: Website

GiGi:
I guess I'm not following instructions very well.

Can you give me step by step instructions with example on how to use Prerequisites to install another product If it is not already installed on the target machine?

I have a folder on our install CD containing the Setup.exe as well as the msi file required for product installation. It's a very lenghty install and would prefer not to attempt to install it if it is already installed.


There is a registry entry in HKLM\Software\ProductName\Version that indicates that the product is installed.

Can you help me in detail please? Need to get this working today!

Thank you very much.

Lee
Lee Bornstein
Posts: 23
Joined: Sat Feb 11, 2006 5:44 am
Location: Las Vegas, NV
Contact: Website

GiGi:

I have been able to get Prerequesites to work for me successfully.

I had to put both installers in the same folder.

Is it possible to have my Project in Root of CD and PreRequisite installer in a separate folder?

Lee
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi Lee,
Is it possible to have my Project in Root of CD and PreRequisite installer in a separate folder?
This can be done by setting the folder name in the "Folder" field from "Edit Prerequisite->Properties" tab. Also make sure you have "Leave install files outside" option set in the "Media->Bootstrapper" page.

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Common Problems”