Wait end of a process - 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!

tarnic
Posts: 26
Joined: Mon May 18, 2009 10:41 am

Wait end of a process

Hi, I have a little problem.
I want to uninstall another program during installation. This is a not MSI previous version of my program.

So, same in the Help, I add a predefined custom action "Launch File or Open an URL" under InstallExecuteSequence -> RemoveExistingProducts. In the Command Line of the viewer.exe, my input is a Search Property, that is the uninstall.exe of the other program, all OK. During installation, AI launch correctly the uninstallation of the other program.
But I want that AI wait that the installation of the other program finish, and then proceed for the new installation. I don't know how to do this...
I thought to use DetectProcess predefined Custom Action, so I check if the uninstallation is running or not, but AI don't wait, it checks only if is running or not. Any ideas?

Thank you very much in advance
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Wait end of a process

Hello,
Please make sure you have the "Synchronous execution, check return code" radio button selected on your viewer.exe's Custom Action Properties pane. The installer will wait for the spawned uninstall process to end, but it will not wait for any other process started by the uninstaller. Also, please note that two msi based simultaneous installation actions are not allowed, therefore it is recommended that you start the uninstall process and wait for it to end before you start the installation of your actual application.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
tarnic
Posts: 26
Joined: Mon May 18, 2009 10:41 am

Re: Wait end of a process

Ok, Thank you. I know this, so I have thought about this solution, let me explain:

When I launch uninstaller.exe of my old application from AI, it launches another process, like "other_unistall_process.exe". I know the name of this process. Because of AI check obviously only uninstaller.exe, it continues the new installation.
My idea is: if I check with "DetectProcess" custom action this new "other_unistall_process.exe", is there any custom action that wait and stop AI until "other_unistall_process.exe" terminate?

Thank you
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Wait end of a process

Hi,

Please note that Windows Installer is the one which launches a custom action and waits for it to finish, this behavior cannot be affected by another custom action. If the custom action which launches the uninstaller uses the "Synchronous execution, check return code" option, Windows Installer will wait for the uninstaller process to finish.

Note that the "Detect Process" custom action is designed to simply detect if a process is running or not. It cannot affect another running custom action based on the result.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tarnic
Posts: 26
Joined: Mon May 18, 2009 10:41 am

Re: Wait end of a process

Thank you for your reply.

But maybe I don't explain very well my problem.
Because uninstaller.exe create another process, like 'unistaller_other_process.exe', AI wait for the end of uninstaller.exe, but not for the second. Is there a custom action, or another way, that AI waits the end of a generic process? (Maybe passed as parameter?) Or, at least, a way that AI waits (pauses, stops) for a little time (some seconds, or a minute)?

Thank you!
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Wait end of a process

Hi,
Because uninstaller.exe create another process, like 'unistaller_other_process.exe', AI wait for the end of uninstaller.exe, but not for the second. Is there a custom action, or another way, that AI waits the end of a generic process? (Maybe passed as parameter?) Or, at least, a way that AI waits (pauses, stops) for a little time (some seconds, or a minute)?
I'm afraid that this is not supported by Windows Installer. A solution would be to use a custom action which launches the uninstall and waits for both processes.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tarnic
Posts: 26
Joined: Mon May 18, 2009 10:41 am

Re: Wait end of a process

cosmin wrote:Hi,

I'm afraid that this is not supported by Windows Installer. A solution would be to use a custom action which launches the uninstall and waits for both processes.

Regards,
Cosmin
Thank you for your help!

How to wait for the second process with custom action?
Because using "Synchronous execution, check return code", AI waits only for the first process (unistaller.exe) lauched by custom action, but not for the second launched by the first process, right?

Thank you Cosmin for your patience!
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Wait end of a process

Hi,
How to wait for the second process with custom action?
You can use custom code. For example, you can use an EXE, a C++ DLL, a .VBS (VBScript) file or any other Win32 custom action.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”