Archive: Skip a Built-In Page


Skip a Built-In Page
My code can detect if a previous version of the application is installed. If the user elects to do an upgrade, I want to skip the welcome and the directory selection pages and go straight to the install files page (and be in the Install section). I'm using MUI v1.67, how do I do this?


you can skip a page by using the abort instruction in the pre callback function for that page


I have tried this:

!define MUI_PAGE_CUSTOMFUNCTION_PRE welcomePre
!insertmacro MUI_PAGE_WELCOME

...

Function welcomePre

${If} $Upgrading == "Yes"
Abort
${EndIf}

FunctionEnd

But when it executes (assume $Upgrading does equal "Yes") the Abort call aborts the entire setup.


Does this happen when you hit the back button to go back to welcome page?

You may want to take a look on this wiki page,

http://nsis.sourceforge.net/Demonstr...Pre_Show_Leave


This code is invoked before the Welcome page is shown (which you knew). If you click back to go back to the welcome page, the $Upgrading variable won't have changed so Abort won't be invoked. If $Upgrading is going to be "Yes", it will happen before any UI is shown so I want to go straight to the InstFiles page, skipping the all UI pages before it.


Check out this wiki page,

http://nsis.sourceforge.net/Go_to_a_NSIS_page


I have a welcome page, an installation selection page, and a database location selection page. Then comes the install files page and finally the setup complete page. This is my my .onInit function in which, when we are upgrading, I try to skip the first three pages. Does anyone see anything incorrect about what I am doing? As of right now, it shows the welcome page once it completes its run of this function (it is correctly identifying the need for any upgrade though).

Function .onInit

#----- Set the version number
StrCpy $Version "00.621.70"

#----- Set upgrading variable. If we are upgrading, it will be changed
# below.
StrCpy $Upgrading "No"

#----- Read registry for install key
ReadRegStr $8 HKLM "Software\Liebert\Install" "NAMInstallDirectory"
ReadRegStr $9 HKLM "Software\Liebert\Install" "NAMVersion"

#----- If key is not blank, NAM already installed, alert and abort if
# we are not upgrading, otherwise, alert to upgrade and act as
# requested by user
${If} $8 != "" ; install key has a value, indicates that NAM is already installed
${If} $9 == $Version ; version that installer has is same as already installed, no need to install
MessageBox MB_ICONINFORMATION|MB_OK "Setup has detected an \
installation of this \
version of Network \
Asset Manager. Setup \
will not continue, now \
exiting."

Abort
${Else} ; version that installer has is not the same as version currently installed (assume installer has newer version), can perform upgrade
MessageBox MB_ICONINFORMATION|MB_YESNO "Setup has detected a \
previous version of \
Network Asset Manager. \
Setup will upgrade the \
version if you select \
Yes. Otherwise, setup \
will exit." IDYes Upgrade IDNo Skip

Upgrade:
#----- Copy locations to variables
StrCpy $INSTALL_DIRECTORY $8 ; read from registry above
ReadRegStr $DATA_DIRECTORY HKLM "Software\Liebert\Database" \
"NAMDatabaseDirectory"

#----- Reset upgrading variable for Install section
StrCpy $Upgrading "Yes"

#----- Skip pages to installer page
SendMessage $HWND 0x408 3 "" $R1

Skip:
#Abort
${EndIf}
${Else}
#----- Copy default locations to variables
StrCpy $INSTALL_DIRECTORY "C:\Apps\Liebert\NetworkAssetManager"
StrCpy $DATA_DIRECTORY "C:\Data"
${EndIf}

FunctionEnd

Thank you in advance and i apologize that I am not understanding how to do this from the help already provided.


I don't think $HWND is set or would even be available this soon to send the page skip message. Your code is also dropping from the Upgrade: label into the Skip: block and does the Abort command when you want to do the Upgrade.

You should wait until the Welcome page is initialized before trying to skip to the other pages.

Don


The problem was the Skip: Abort. I moved that above the Upgrade goto and added abort statements to the pre functions of the pages that I wanted to skip and now it works.

Thanks all for the help.

Nik