- NSIS Discussion
- Run Program automatically after install?
Archive: Run Program automatically after install?
Panarchy
27th April 2009 05:31 UTC
Run Program automatically after install?
Hello
How do I run my program automatically after an install?
Tried following this guide: http://nsis.sourceforge.net/Run_an_a...ter_an_install but didn't work for me.
Here is my nsi;
!include MUI2.nsh
Name `Maintenance`
OutFile `Maintenance Installer.exe`
BrandingText `Created by Panarchy`
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE license.txt
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English
Section
!macro ExtractMaintenance ToDir
SetOutPath `${ToDir}`
File "Maintenance Script.exe"
!macroend
!insertmacro ExtractMaintenance "C:\NoWhereInParticular"
CreateShortcut "$DESKTOP\Maintenance.lnk" "C:\NoWhereInParticular\Maintenance Script.exe"
SectionEnd
Please tell me how to integrate a 'run program on finish' feature.
Thanks in advance,
Panarchy
lewellyn
27th April 2009 07:34 UTC
I use something like this:
!define MUI_FINISHPAGE_RUN "$INSTDIR\${PROGEXE}"
!define MUI_FINISHPAGE_RUN_TEXT "Launch ${PRODUCTNAME}"
Yes, I !define PROGEXE and PRODUCTNAME early on in the script (along with lots of other potentially repetitive things). :)
Panarchy
27th April 2009 08:08 UTC
Thanks.
Just tried that, it didn't work.
Please recommend another method.
Thanks in advance,
Panarchy
lewellyn
27th April 2009 08:10 UTC
Can you define "it didn't work"? Did it cause compiler errors? Did it not show the checkbox? Did it not actually launch the exe?
Afrow UK
27th April 2009 13:05 UTC
Make sure you put the defines before !insertmacro MUI_PAGE_FINISH.
Stu
Panarchy
28th April 2009 00:19 UTC
Thanks, I think I finally got it to work.
Panarchy
28th April 2009 00:30 UTC
Confirming;
Yes, it works!!!
Thanks Afrow (and lewellyn for replying...)
ledruide
19th March 2010 00:29 UTC
and in silent mode...
Any idea on how to start an application after a silent install ?
Can't find anything yet....
Afrow UK
19th March 2010 00:37 UTC
Just put a Section at the end that does it, or use Function .onInstSuccess.
Edit: And if necessary wrap the code inside it with an ${If} ${Silent}.
Stu
ledruide
19th March 2010 00:42 UTC
Function .onInstSuccess
Exec "blablabla.exe"
FunctionEnd
Found your other post, thank you
th_mi
23rd March 2010 11:07 UTC
Originally posted by ledruide
Function .onInstSuccess
Exec "blablabla.exe"
FunctionEnd
Only as a hint.
If your installer was elevated (under Vista or Seven), the executable started by "Exec" is also elevated. And it is not good to start the application with this privileges without any good reason.
msroboto
23rd March 2010 16:04 UTC
I am using the UAC_AsUser_Execshell from the UAC plug-in.
http://nsis.sourceforge.net/UAC_plug-in
This should prevent the program from running elevated.