Old 27th April 2009, 04:31   #1
Panarchy
Member
 
Join Date: Nov 2008
Posts: 72
Question 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;

code:
!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
Panarchy is offline   Reply With Quote
Old 27th April 2009, 06:34   #2
lewellyn
Member
 
Join Date: Nov 2002
Location: San Francisco, CA
Posts: 82
Send a message via ICQ to lewellyn Send a message via AIM to lewellyn Send a message via Yahoo to lewellyn
I use something like this:

code:
!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).
lewellyn is offline   Reply With Quote
Old 27th April 2009, 07:08   #3
Panarchy
Member
 
Join Date: Nov 2008
Posts: 72
Thanks.

Just tried that, it didn't work.

Please recommend another method.

Thanks in advance,

Panarchy
Panarchy is offline   Reply With Quote
Old 27th April 2009, 07:10   #4
lewellyn
Member
 
Join Date: Nov 2002
Location: San Francisco, CA
Posts: 82
Send a message via ICQ to lewellyn Send a message via AIM to lewellyn Send a message via Yahoo to lewellyn
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?
lewellyn is offline   Reply With Quote
Old 27th April 2009, 12:05   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Make sure you put the defines before !insertmacro MUI_PAGE_FINISH.

Stu
Afrow UK is offline   Reply With Quote
Old 27th April 2009, 23:19   #6
Panarchy
Member
 
Join Date: Nov 2008
Posts: 72
Thanks, I think I finally got it to work.
Panarchy is offline   Reply With Quote
Old 27th April 2009, 23:30   #7
Panarchy
Member
 
Join Date: Nov 2008
Posts: 72
Confirming;

Yes, it works!!!

Thanks Afrow (and lewellyn for replying...)
Panarchy is offline   Reply With Quote
Old 18th March 2010, 22:29   #8
ledruide
Junior Member
 
Join Date: Aug 2009
Posts: 3
Unhappy and in silent mode...

Any idea on how to start an application after a silent install ?

Can't find anything yet....
ledruide is offline   Reply With Quote
Old 18th March 2010, 22:37   #9
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 18th March 2010, 22:42   #10
ledruide
Junior Member
 
Join Date: Aug 2009
Posts: 3
Function .onInstSuccess
Exec "blablabla.exe"
FunctionEnd

Found your other post, thank you
ledruide is offline   Reply With Quote
Old 23rd March 2010, 09:07   #11
th_mi
Member
 
Join Date: Sep 2005
Location: Sitting next to my desk
Posts: 56
Quote:
Originally Posted by ledruide View Post
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.

This signature is currently on vacation!
th_mi is offline   Reply With Quote
Old 23rd March 2010, 14:04   #12
msroboto
Junior Member
 
Join Date: Sep 2006
Posts: 47
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.
msroboto is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump