BeerBullet
28th September 2005 10:10 UTC
Skipping multiple pages - need help
Hi there...
I wrote a small Installer with a custom Page, where you can add a ODBC-Datasource. So far so nice...
The problem is, if the programm is already installed I want to skip the welcome, directory and my custom page. How can I do this?
Some Code:
!define MUI_PAGE_CUSTOMFUNCTION_PRE checkUpdate
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Select ODBC Page
Page custom SelectODBCPage LeaveSelectODBCPage
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
.
.
.
Function checkUpdate
ReadRegStr $appInstalled HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName"
strcmp $appInstalled "" install
MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(ASK_UPDATE)" IDYES +2 IDNO 0
quit
install:
FunctionEnd
I already found the MUI_PAGE_CUSTOMFUNCTION_PRE macro, but how can I use this or something like that more than once?
THX NSIS gods!!
deguix
28th September 2005 10:23 UTC
You could use that define for all the 3 pages, or you could use the function Go to a NSIS page. That one you just need to use once.
BeerBullet
28th September 2005 13:54 UTC
thank you deguix
..the first hint did it. This "jump"-function didn't work for me..I dont know why. Anyway..I got a solution :D
Note:I have to call the "checkUpdate"-function in my Custom-Create-Function (SelectODBCPage) manually. Didn't work with !define MUI_PAGE_CUSTOMFUNCTION_PRE "checkUpdate"
Some code for copy and pasters:
Var appInstalled
Var doUpdate
.
.
.
!define MUI_PAGE_CUSTOMFUNCTION_PRE "checkUpdate"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_PRE "checkUpdate"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Select ODBC Page
Page custom SelectODBCPage LeaveSelectODBCPage
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
.
.
.
Function .onInit
strcpy $doUpdate false
.
.
.
FunctionEnd
Function checkUpdate
strcmp $doUpdate true skip
ReadRegStr $appInstalled HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName"
strcmp $appInstalled "" install
MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(ASK_UPDATE)" IDYES update IDNO 0
quit
skip:
abort
update:
strcpy $doUpdate true
abort
install:
FunctionEnd
.
.
.
Function SelectODBCPage
call checkUpdate
.
.
.
FunctionEnd