Launch an existing exe before install - Advanced Installer Community

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!

Ulli
Posts: 17
Joined: Tue Dec 30, 2008 12:44 pm

Launch an existing exe before install

How can I launch an existing exe-file before the installation.
The exe-file is not part of the installation. It is already present in APPDIR /Install is upgrade.

Any help and tips are appreciated, because I have spent many hours now on the problem.

Thanks in advance
Ulli
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Launch an existing exe before install

Hi Ulli,

You can launch an existing file by using a "Launch file or open URL" custom action. Since you want to launch it when the installation starts, you can schedule it under "InstallUISequence" -> "Begin" (if your package uses an UI) or "InstallExecuteSequence" -> "Begin" (if your package doesn't or may not use an UI).

Please note that you can show the "Begin" standard action by using the "Show Standard Action" button on the toolbar of the "Custom Actions" page.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Ulli
Posts: 17
Joined: Tue Dec 30, 2008 12:44 pm

Re: Launch an existing exe before install

Hello Cosmin,

thanks for your quick answer!

I have already done what you described.
Here is what I did after inserting BEGIN:

New Custom Action -> Exe with Working Dir
As WorkingDir I chose APPDIR, because the exe-file resides there.
Full Path : [APPDIR][#SKUser.exe]

All the other options I left unchanged.

And this unfortunately does not work.
Where is my mistake?
Regards

PS: I get the error code 2732
Ulli
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Launch an existing exe before install

Hi,
New Custom Action -> Exe with Working Dir
As WorkingDir I chose APPDIR, because the exe-file resides there.
Full Path : [APPDIR][#SKUser.exe]
Please note that "[#SKUser.exe]" is a reference to a file in your package. During installation this reference will be resolved to the full path of the file, so the command line would be resolved to two paths one after another. Since the EXE is already installed in "Application Folder", you can launch it through this command line:

Code: Select all

"[APPDIR]SKUser.exe"
The quotes will make sure that the path is recognized even if it contains spaces. However, since you are using the APPDIR property and not a hard-coded path to the file, the custom action needs to be moved after the "CostFinalize" standard action. The APPDIR property contains a valid path only after this standard action runs.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Ulli
Posts: 17
Joined: Tue Dec 30, 2008 12:44 pm

Re: Launch an existing exe before install

Hi Cosmin,

thanks a lot for your help. It is working now!
So I can call a program which must be present.

But what about the following scenario?

I would like to distribute a setup-file which has an installer and a separate program.
Before installation it should be possible to copy /unpack the separate program to a temp-folder and call it from there to do some upgrading work.
After that this program can call the installer.

Is this possible with AI?

Regards
Ulli
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Launch an existing exe before install

Hi,

If the program is a small EXE application, you can add it as an Attached custom action instead of using a "Launch file or open URL" one. This way the EXE will be stored in the MSI in a special table ("Binary") so it can be called whenever you want.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Ulli
Posts: 17
Joined: Tue Dec 30, 2008 12:44 pm

Re: Launch an existing exe before install

Hi,

unfortunately this EXE needs some DLLs.
Is it still possible?

Regards
Ulli
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Launch an existing exe before install

Hi,

I'm afraid that Windows Installer cannot handle the dependencies of the EXE. A solution would be to add the DLLs and the EXE as temporary files. In this case you can use an "Exe with working dir" custom action to launch the EXE.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Ulli
Posts: 17
Joined: Tue Dec 30, 2008 12:44 pm

Re: Launch an existing exe before install

Hi Cosmin,
I'm afraid that Windows Installer cannot handle the dependencies of the EXE.
Thank you. That confirms my findings.
It works, if the DLLs are located next to the MSI-file.
A solution would be to add the DLLs and the EXE as temporary files. In this case you can use an "Exe with working dir" custom action to launch the EXE.
But that would mean that the DLLs would have to be installed into the Windows-directory, right?
So in my opinion, I would not be able to call my EXE before the installation, right?

Regards
Ulli
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Launch an existing exe before install

Hi,
But that would mean that the DLLs would have to be installed into the Windows-directory, right?
No, the temporary files can be created in any folder you want. They are extracted right after "CostFinalize" and removed after the installation is finished. Therefore, you can use them when you need. Please note that a custom action which uses a temporary file should be scheduled after "InstallExecuteSequence" -> "MigrateFeatureStates".

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Ulli
Posts: 17
Joined: Tue Dec 30, 2008 12:44 pm

Re: Launch an existing exe before install

Hi Cosmin,
No, the temporary files can be created in any folder you want. They are extracted right after "CostFinalize" and removed after the installation is finished.
That would be my perfect solution.
Here is what I did:
Files and Folders
I included the EXE and the DLLs in Target Computer/Desktop/Temp.
Custom Actions
InstallExecuteSequence / MigrateFeatureStates -> New Custom Action -> Exe with WorkingDir

Result:
The EXE and the DLLs are extracted to the Temp-folder on the desktop.
The EXE is correctly called just before the installation (progress window) begins. So this is quite good. I personally would like to have my EXE shown up earlier.

But I still have the problem that the return code of my EXE is ignored (see other thread).

The only question left here is if it is possible to have my EXE show up earlier.

Thanks for your excellent support.
Ulli
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Launch an existing exe before install

Hi Ulli,
The only question left here is if it is possible to have my EXE show up earlier.
You can try this improvement:
- go to the "Custom Actions" page and show the "InstallUISequence" -> "MigrateFeatureStates" standard action
- select your custom action
- while the SHIFT key is pressed drag it over "InstallUISequence" -> "MigrateFeatureStates"
- in its "Custom Action Properties" page select the "Execute only once if present in both sequence tables" option

This way the custom action will be shared between the UI Sequence (when the dialogs are shown) and the Execute Sequence (when the actual installation is performed). If the installation uses an UI, the EXE will be launched by the first instance of the custom action, right before the "WelcomeDlg" dialog is shown.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Ulli
Posts: 17
Joined: Tue Dec 30, 2008 12:44 pm

Re: Launch an existing exe before install

Hi Cosmin,
it works: My EXE is started earlier.
Thank you very much.

Best wishes for the new year
Ulli

PS: And if you also solve my other problem in the other thread "Return code with custom action" you will be my hero! :wink:

Return to “Common Problems”