Skip to content
⌘ NSIS Forum Archive

How can I lunch my app after install?

15 posts

Angry Coder#

How can I lunch my app after install?

Hello,

I would like to know how can I lunch my app after installation?

Please advise.
Red Wine#
for classic UI you have to set up a custom page name it additional tasks or something similar and prompt users e.g. to create quick launch shortcut, launch application when installation is finished, launch help file, visit website etc.
According to the info collected on that page, create custom functions to do the requested action, e.g if the user has selected launch application, then .onInstSuccess exec $INSTDIR\myapp.exe and so on.
Angry Coder#
k thanks, Exec "$INSTDIR\My Program.exe" has worked on installation to lunch the app... How can I close the program to uninstall it in case it's running?!
Red Wine#
Generally it's not good idea launching an app without prompt users if they want this action.
As for close a prog, either use FindWindow/SendMessage or use the system plugin Call (see system plugin documentation/examples) to perform this action.
Also there is a plugin at wiki named find proccess that could do this job.
Angry Coder#
I guess I have to use SendMessage since my app runs on the background.

But How can I do that?

Thanks.
Red Wine#
if the app that you wish to terminate is running on backround, obviously it has not a window, therefore you must find it by proccess, either with system plugin or with find proccess plugin.
In every case, the best way for you to learn, is to read the nsis manual , perform forum search for specified actions, and get experience with included in NSIS installation directory examples, as well with wiki articles and examples.
Angry Coder#
My app runs each 15 minutes for 20 secondes, so it has a window, but it's invisible most of the time.
onad#
Kill the app if it is still running before new installation

KillProcDLL::KillProc "MYAPP.EXE"

But better use a sendmessage
Even better if you wrote the application yourself handle a QUIT parameter e.g. if it is ruinning make sure the renewed params are handeled.
ShellExec MYAPP.EXE /Q

even better... search the forum first 😉