Finish Page Option Fails To Execute
I have a finish page with three options:
1) Create Desktop shortcut
2) Create Quick Launch shortcut
3) Launch MyApp
If option #2 is de-selected then the last option, #3, doesn't execute. I'm at a loss to figure out why. Can someone point in proper direct here? This is my script:
;NSIS Modern User Interface
;Welcome/Finish Page Example Script
;Written by Joost Verburg
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
SetCompressor BZIP2
;--------------------------------
;General
;Name and file
Name "My App"
OutFile "\\MyServer\C\MyCompany\Projects\MyCompany Corp\TGD Projects\Premium\TGD\NSIS\myapp.exe"
XPStyle on
RequestExecutionLevel admin
!define MUI_ICON "\\MyServer\C\MyCompany\Projects\MyCompany Corp\TGD Projects\Premium\TGD\NSIS\tgd.ico"
!define MUI_UNICON "\\MyServer\C\MyCompany\Projects\MyCompany Corp\TGD Projects\Premium\TGD\NSIS\tgd.ico"
;Default installation folder
InstallDir "$PROGRAMFILES\My App"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\My App" ""
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "My App"
VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "Inventory, backup, restore and locate system drivers."
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "MyCompany Corp."
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "My App is a trademark of MyCompany Corp."
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© MyCompany Corp. 2003 - 2008"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Inventory, backup, restore and locate system drivers."
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "2.1.29"
VIProductVersion "2.1.29.0"
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "\\MyServer\C\MyCompany\Projects\MyCompany Corp\TGD Projects\Premium\TGD\NSIS\Install Path\License.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
;!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Modified Finish Page
!define MUI_PAGE_CUSTOMFUNCTION_PRE fin_pre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW fin_show
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE fin_leave
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION Desc_ShortCut
!define MUI_FINISHPAGE_RUN_TEXT "Create Desktop Shortcut"
!insertmacro MUI_PAGE_FINISH
;!insertmacro MUI_UNPAGE_WELCOME
;!insertmacro MUI_UNPAGE_CONFIRM
;!insertmacro MUI_UNPAGE_INSTFILES
;!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Functions
Function Desc_Shortcut
SetOutPath "$INSTDIR"
CreateShortCut "$DESKTOP\My App.lnk" "$INSTDIR\myprog2.exe"
FunctionEnd
Function fin_show
;--------------------------------
;Create Start Menu Program Files Shortcut
CreateDirectory "$SMPROGRAMS\My App"
CreateShortcut "$SMPROGRAMS\My App\My App.lnk" "$INSTDIR\myprog2.exe"
CreateShortCut "$SMPROGRAMS\My App\My App Home Page.lnk" "http://www.mycoolprog.com/" "URL" "" "" "" "" "My App Home Page"
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 6" "HWND"
SetCtlColors $0 0x000000 0xFFFFFF
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 7" "HWND"
SetCtlColors $0 0x000000 0xFFFFFF
FunctionEnd
Function fin_pre
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Settings" "NumFields" "6"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Type" "CheckBox"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Text" "&Create Quicklaunch Shortcut"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Left" "120"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Right" "315"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Top" "110"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Bottom" "120"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "State" "1"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Settings" "NumFields" "7"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 7" "Type" "CheckBox"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 7" "Text" "&Launch My App"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 7" "Left" "120"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 7" "Right" "315"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 7" "Top" "130"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 7" "Bottom" "140"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 7" "State" "1"
FunctionEnd
Function fin_leave
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 6" "State"
StrCmp $0 "0" end
SetOutPath "$INSTDIR"
CreateShortCut "$QUICKLAUNCH\My App.lnk" "$INSTDIR\myprog2.exe"
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 7" "State"
StrCmp $0 "0" end
SetOutPath "$INSTDIR"
Exec "$INSTDIR\myprog2.exe"
end:
FunctionEnd
;--------------------------------
;Installer Sections
Section "Dummy Section" SecDummy
SetOutPath "$INSTDIR"
;ADD YOUR OWN FILES HERE...
File "\\MyServer\C\MyCompany\Projects\MyCompany Corp\TGD Projects\Premium\TGD\myprog2.exe"
File "\\MyServer\C\MyCompany\Projects\MyCompany Corp\TGD Projects\Premium\TGD\Help\drvgdtk2.chm"
File "\\MyServer\C\MyCompany\Projects\MyCompany Corp\TGD Projects\Premium\TGD\NSIS\Install Path\*.*"
SetOutPath "$INSTDIR\bin"
File "\\MyServer\C\MyCompany\Projects\MyCompany Corp\TGD Projects\Premium\TGD\NSIS\bin\*.*"
SetOutPath "$SYSDIR"
SetOverwrite try
File "\\MyServer\C\MyCompany\Projects\MyCompany Corp\TGD Projects\Premium\TGD\NSIS\System Path\*.*"
SetOutPath "$SYSDIR\wbem"
SetOverwrite off
File "\\MyServer\C\MyCompany\Projects\MyCompany Corp\TGD Projects\Premium\TGD\NSIS\wbem\*.*"
;Store installation folder
WriteRegStr HKCU "Software\My App" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
RegDLL "$INSTDIR\bin\Codejock.CommandBars.v10.4.0.ocx"
RegDLL "$INSTDIR\bin\Codejock.DockingPane.v10.4.0.ocx"
RegDLL "$INSTDIR\bin\Codejock.PropertyGrid.v10.4.0.ocx"
RegDLL "$INSTDIR\bin\Codejock.ReportControl.v10.4.0.ocx"
RegDLL "$INSTDIR\bin\Codejock.TaskPanel.v10.4.0.ocx"
RegDLL "$SYSDIR\MSCOMCTL.OCX"
RegDLL "$SYSDIR\msvbvm60.dll"
RegDLL "$SYSDIR\scrrun.dll"
RegDLL "$SYSDIR\shfolder.dll"
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\My App" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\My App" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\My App" "DisplayName" "My App"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\My App" "DisplayIcon" "$INSTDIR\myprog2.exe,0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\My App" "DisplayVersion" "2.1.29"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\My App" "URLInfoAbout" "http://www.mycoolprog.com/"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\My App" "HelpLink" "http://www.mycoolprog.com/"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\My App" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\My App" "NoRepair" "1"
SectionEnd
;--------------------------------
;Descriptions
;Language strings
;LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
;Assign language strings to sections
;!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
;!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
;!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;ADD YOUR OWN FILES HERE...
;ExecWait 'regsvr32.exe /u /s "$INSTDIR\bin\Codejock.CommandBars.v10.4.0.ocx"'
;ExecWait 'regsvr32.exe /u /s "$INSTDIR\bin\Codejock.DockingPane.v10.4.0.ocx"'
;ExecWait 'regsvr32.exe /u /s "$INSTDIR\bin\Codejock.PropertyGrid.v10.4.0.ocx"'
;ExecWait 'regsvr32.exe /u /s "$INSTDIR\bin\Codejock.ReportControl.v10.4.0.ocx"'
;ExecWait 'regsvr32.exe /u /s "$INSTDIR\bin\Codejock.TaskPanel.v10.4.0.ocx"'
RMDir /r /REBOOTOK "$INSTDIR"
RMDir /r "$SMPROGRAMS\My App"
Delete "$DESKTOP\My App.lnk"
Delete "$QUICKLAUNCH\My App.lnk"
DeleteRegKey HKCU "Software\My App"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\My App"
Delete "$INSTDIR\Uninstall.exe"
SectionEnd