AI_LaunchApp is not waiting for custom action to finish - 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!

BobCrothers
Posts: 66
Joined: Wed Dec 05, 2007 10:58 pm

AI_LaunchApp is not waiting for custom action to finish

Hi,

I have a custom action, called “Config” which is setup as
Source path viewer.exe
Source Type Executable(*.exe)
Command Line: "[#Configure_RAPID_Servers.bat]"
Synchronous execution, check return code
Immediate execution

The user can select to launch the Config by checking a check box on the ExitDialog. The “Finish” button on the ExitDialog has Publihed Events DoAction- Config which comes before AI_LaucnchApp. AI_LaucnchApp is a .bat file which launches our application.


AI_LaucnchApp is fired before Config is finished. I need Config to finish before the launching of the application. How do I make sure that Config is finished before the application is launched.

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

Hi,

I'm not sure what exactly your Config BAT file does. Can you please give me more details about this?

If it launches some processes, you can try to use the start command with the /wait argument:
http://www.computerhope.com/starthlp.htm

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
BobCrothers
Posts: 66
Joined: Wed Dec 05, 2007 10:58 pm

Hi Cosmin,

I know there is a bug here. I was going come up with a simple case, and write down the exact steps. This time it worked! I played around trying various firing orders, now there is a different bug. I played around as described below, later I added action four. Moved action four up in the firing order, now it never fires!

If you play around with this simple test case I think you will see that the firing order does get confused.

Create 3 bat files, called one, two, three. Each bat file prints its name and waits. As an example of one.bat

@echo off
@echo This is one
pause


Create a new project, I use Enterprise project type.

Copy the 3 bat files into the project folder.
Add the 3 bat files to be installed in Application Folder
Create 3 custom actions
I used “Add predefined custom action”, “Launch File”
The command lines will look like
"[#one.bat]"
Rename the custom actions one, two, three.

Go to the Exit Dialog
Finish Actions, “Launch application at the end of installation”
Launch bat file three

On the Published Events for Finish Add
Action one
Action two

The Published Events lists now looks like
DoAction AI_VeiwReadme
DoAction AI_LaunchApp
EndDialog Return
DoAction one
DoAction two



Test the install
Action three is run first, without waiting for three to finish, action one is run.
When one is finished two is run.

Now go to Published Events list
Move actions one and two up.
The list now looks like

DoAction AI_VeiwReadme
DoAction one
DoAction two
DoAction AI_LaunchApp
EndDialog Return

One is run, everything waits until finished
Then two, waits
Three waits

If you try adding new actions four and or changing the order. Advanced installer gets confused. It launches the application before all the actions in the list.

Sorry I can’t come up with the exact steps.

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

Hi,

This is not a bug, it is the normal behavior.
Test the install
Action three is run first, without waiting for three to finish, action one is run.
When one is finished two is run.
Please note that the "AI_LaunchApp" custom action doesn't wait for the custom actions to finish. This is because there would be no reason to wait (and keep showing the "ExitDialog") until a custom action is finished.

If you want to run multiple custom actions when the user presses the "Finish" button, you need to make sure that they are executed before the "AI_LauncgApp" custom action.
If you try adding new actions four and or changing the order. Advanced installer gets confused. It launches the application before all the actions in the list.
I cannot reproduce this behavior on my test machine. If you schedule multiple custom actions for the finish button, they will be executed in the order you see in the "Published Events" tab.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
BobCrothers
Posts: 66
Joined: Wed Dec 05, 2007 10:58 pm

Thanks Cosmin,

Advanced Installler does a great job responding to forum issues.
If you want to run multiple custom actions when the user presses the "Finish" button, you need to make sure that they are executed before the "AI_LauncgApp" custom action.
How do I do this?

What I have done is to create a vbs script which is called when the finish button is executed. It uses system properties to determine which actions to fire, waits until that action is finished and then launches the application if requested. Is there a way to achieve this within Advanced Installer and the exit dialog?

Thanks.
Bob
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

In order to wait for the script to finish, you need to make sure that the DoAction control event which launches the script is above the DoAction control event which runs the AI_LaunchApp custom action.

Note that these control events are shown in the "Published Events" tab for the "Finish"button.

However, note that the installation waits for the custom action, not for what the custom action does. For example, if the custom actions runs something else or creates a new process, then the installation will not wait for that process to finish.

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

Return to “Common Problems”