How to install custom action to launch EXE? - 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!

Peter350
Posts: 30
Joined: Sat Oct 17, 2009 1:56 pm

How to install custom action to launch EXE?

I am trying to use the taskkill.exe windows command to kill multiple instances of the same executable file, at the start of the install.

Under the "Begin" sections of InstallUISequence, and InstallExecuteSequence, I have added a custom action of type:

"EXE with Working Directory and path given by a Formatted"

WorkingDir is APPDIR

The "Full Path" is not a full path (I wish to rely upon the system to find the command) so reads:

taskkill.exe /f /im [APPDIR]MyTarget.exe

Synchronous, immediate execution, Execute only once if present in both sequence tables.

I get an error msgbox "Directory Manager Not Initialized".

According to MSDN, "The directory manager is responsible for determining the target and source paths. It is initialized during the costing actions (CostInitialize action, FileCost action, and CostFinalize action). A standard action or custom action made a call to a function requiring the directory manager before the initialization of the directory manager. This action should be sequenced after the costing actions."

I have tried installing these three "costing" actions but I am unable to move them before the Begin section?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: How to install custom action to launch EXE?

Hello,

Changing the order of those standard actions is not needed. Simply place your taskkill custom action after the CostFinalize standard action by drag-and-dropping it right underneath it.

I hope this helps.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
Peter350
Posts: 30
Joined: Sat Oct 17, 2009 1:56 pm

Re: How to install custom action to launch EXE?

Thanks, that works.

I needed to specify the bare command (no path) for taskkill.exe so the system finds it. I therefore used "Exe with path given by a property" and set the property to be the name taskkill.exe, passing my args on the Command Line field.

The issue is it pops up a temporary cmd window which is rather ugly. The standard way to start a .bat silently is with a .pif, however, there seems no way to package and extract the two files before executing them this early on in the installer.

Is there any way to cause the command to be executed silently or minimized?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: How to install custom action to launch EXE?

Hi Peter,

Add a, for example, "Close Application" custom action. Go to the right pane and from the Function Name combo, select "CreateExeProcess". In the action data field, input the command line to launch your batch file.

Let me know if this works for you.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”