Run an application shortcut after an install: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Wikipedia python library)
 
m (Updated author and download links, and changed format of some pages.)
Line 24: Line 24:
</highlight-nsis>
</highlight-nsis>


 
Page author: [[User:jpannequin|jpannequin]]
Page author: jpannequin

Revision as of 12:41, 23 April 2005

Description

Here is how to launch a shortcut at the end of an install (in the MUI). You may need this if you need to use a specific working directory and don't want to modify the MUI.

Usage

So suppose I want to launch "C:\User\test.lnk".

Before calling the macro for finish, you must define the run variables. If you define

!define MUI_FINISHPAGE_RUN "C:\User\test.lnk"

it will not work, because it is not an application.

You must set MUI_FINISHPAGE_RUN empty, and use a function instead.

!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Start a shortcut"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!insertmacro MUI_PAGE_FINISH

You can then define the function and execute the link with ExecShell.

Function LaunchLink
  ExecShell "" "C:\User\test.lnk"
FunctionEnd

Page author: jpannequin