Archive: Run Program automatically after install?


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

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). :)

Thanks.

Just tried that, it didn't work.

Please recommend another method.

Thanks in advance,

Panarchy


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?


Make sure you put the defines before !insertmacro MUI_PAGE_FINISH.

Stu


Thanks, I think I finally got it to work.


Confirming;

Yes, it works!!!

Thanks Afrow (and lewellyn for replying...)


and in silent mode...
Any idea on how to start an application after a silent install ?

Can't find anything yet....


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


Function .onInstSuccess
Exec "blablabla.exe"
FunctionEnd

Found your other post, thank you


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.

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.