[sword-devel] BibleCS Installer: readme before executables
L.Allan-pbio
paraclete at bibleinverse.org
Thu Feb 9 23:05:19 MST 2006
> By having them, we sign up to the responsibility for internationalizing
> those pages, should the need arise.
Good point ... I hadn't considered that.
Regarding getting readme.txt to show up by itself before InstallManager.exe
and sword.exe (split from general Installer thread to be focused on this
issue alone) :
I did some more experimenting with MUI_FINISHPAGE and have several different
approaches (A, B, C, and D) for you to consider.
A: Have just the "Run" function available, and it inflexibly shows the
readme, then invokes InstallManager, then invokes sword.exe
B: Have just the "Run" function, and it inflexibly shows the readme, then
invokes the InstallManager. There is a .onInstSuccess function that always
invokes sword.exe. The .onInstSuccess turns out to run after the FINISH
functions, so use ExecWait for the FINISH functions.
C: Have the Run function simple set a RunExecutableFlag variable. The readme
function would use:
ExecWait 'notepad $INSTDIR\readme.txt'
Then then .onInstSuccess function would check the RunExecutableFlag variable
and proceed accordingly.
(See Option C code below)
D: It turns out that the FinishPage Run function actually runs first before
the Readme function. (This would be the norm with the readme being the last
thing shown.) It appears that they show up together, because I suppose they
are invoked with the equivalent of Exec-No-Wait
It isn't pretty, but you can "swap" the run function and readme function,
and have the readme shown before the InstallManager+sword by using:
ExecWait 'notepad $INSTDIR\readme.txt' (see source code below)
Below Option C code is Option D sample code, with MessageBox stubs for
InstallManager.exe and sword.exe. The noteworthy features are
SwappedReadmeFunction and SwappedRunFunction.
;******* Option C ***************************
!include "MUI.nsh"
Name "Modern UI Test"
OutFile "MuiFinishPageRunFunction_D.exe"
InstallDir "$PROGRAMFILES\Modern UI Test"
InstallDirRegKey HKCU "Software\Modern UI Test" ""
ShowInstDetails show
;--------------------------------
;Pages
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN_TEXT "Run InstallManager and then sword.exe"
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION SetRunExecutableFlag
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Show InstallManager info"
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowInstallManagerInfo
!insertmacro MUI_PAGE_FINISH
;Languages
!insertmacro MUI_LANGUAGE "English"
Var RunExecutablesFlag
;--------------------------------
# No components page, so this is anonymous
Section "Dummy Section" SecDummy
SetOutPath "$INSTDIR"
File readme.txt
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
WriteUninstaller "$INSTDIR\Uninstall.exe"
DetailPrint "Reached Dummy section"
SectionEnd
Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\Modern UI Test"
SectionEnd
Function .onInit
StrCpy $RunExecutablesFlag 0
FunctionEnd
Function SetRunExecutableFlag
StrCpy $RunExecutablesFlag 1
FunctionEnd
Function ShowInstallManagerInfo
ExecWait 'notepad $INSTDIR\readme.txt'
FunctionEnd
Function .onInstSuccess
StrCmp $RunExecutablesFlag 1 0 PastRunningExecutables
MessageBox MB_OK 'InstallManager would run here as ExecWait'
MessageBox MB_OK 'sword.exe would run here as Exec after InstallManager'
PastRunningExecutables:
FunctionEnd
;******* Option C ***************************
;******* Option D ***************************
!include "MUI.nsh"
Name "Modern UI Test"
OutFile "MuiFinishPageRunFunction.exe"
InstallDir "$PROGRAMFILES\Modern UI Test"
InstallDirRegKey HKCU "Software\Modern UI Test" ""
ShowInstDetails show
;--------------------------------
;Pages
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN_TEXT "Show InstallManager information"
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION SwappedReadmeFunction
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Run InstallManager and then
sword.exe"
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION SwappedRunFunction
!insertmacro MUI_PAGE_FINISH
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
# No components page, so this is anonymous
Section "Dummy Section" SecDummy
SetOutPath "$INSTDIR"
File readme.txt
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
WriteUninstaller "$INSTDIR\Uninstall.exe"
DetailPrint "Reached Dummy section"
SectionEnd
Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\Modern UI Test"
SectionEnd
Function SwappedReadmeFunction
ExecWait 'notepad $INSTDIR\readme.txt'
FunctionEnd
Function SwappedRunFunction
MessageBox MB_OK 'InstallManager would run here as ExecWait'
MessageBox MB_OK 'sword.exe would run here as Exec after InstallManager'
FunctionEnd
;******* Option D ***************************
More information about the sword-devel
mailing list