drsPee
drsPee

Reputation: 21

How to execute a command from a NSIS finish page

After having tried various methods, I never got the finish page with a checkbox in it. Q&A on stackoverflow suggested to use the !define MUI_PAGE_FINISH_RUN command just before the !insertmacro MUI_PAGE_FINISH command.

So I took the example WelcomeFinish.nsi and added only 1 line !define MUI_PAGE_FINISH_RUN "Notepad.exe" just before the !insertmacro MUI_PAGE_FINISH command. Still no checkbox on the finish page.

What am i doing wrong? I am using Win7 Professional on a 64-bit machine

Upvotes: 1

Views: 2521

Answers (1)

trooper
trooper

Reputation: 4512

The following NSIS documentation describes how to accomplish this: http://nsis.sourceforge.net/Run_an_application_shortcut_after_an_install

You need to add the following defines before MUI_PAGE_FINISH:

!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Launch notepad"
!define MUI_FINISHPAGE_RUN_FUNCTION "StartNotepad"
!insertmacro MUI_PAGE_FINISH

We are setting MUI_FINISHPAGE_RUN to be empty and instead defining a function in MUI_FINISHPAGE_RUN_FUNCTION to be run (we're calling our function StartNotepad). It will launch the process we are interested in (or shortcut/lnk) using ExecShell:

Function StartNotepad
  ExecShell "" "notepad.exe"
FunctionEnd

Upvotes: 1

Related Questions