Old 19th February 2014, 17:29   #1
jt9000
Junior Member
 
Join Date: Feb 2014
Posts: 5
NSIS Conditional Custom Page

I would like to create a custom page that appears only if the detected OS is 32 bit.
If the OS is 32 bit, the custom page will display a link to download the 32 bit installer, and only has "exit" button available to quit the installer.

Any examples on how this can be done?
So far I have the following snippets that detect the OS and make decisions as to whether to skip the custom page or display it.


code:
;Page showing download link for 32bit if OS is 32bit
Page custom Download32bit

#Custom page function to ask user to download 32bit installer
Function Download32bit
# Check if OS is 64 bit
${If} ${RunningX64}
Goto passOSCheck
${Else}
!insertmacro MUI_HEADER_TEXT $(DOWNLOAD32BIT_TITLE) $(DOWNLOAD32BIT_SUBTITLE)
MessageBox MB_OK "Your Operating System is 32-bit, please download HexSight 32bit installer."
Quit
${EndIf}
passOSCheck:
FunctionEnd

LangString DOWNLOAD32BIT_TITLE ${LANG_ENGLISH} "Download HexSight 32-bit"
LangString DOWNLOAD32BIT_SUBTITLE ${LANG_ENGLISH} "Please visit download 32-bit installer"



p.s. what is the correct method to change the body of the page? I've only found MUI_HEADER_TEXT to change the headers.
jt9000 is offline   Reply With Quote
Old 19th February 2014, 17:37   #2
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
And what exactly is your question or problem?

Just put the OS check in the pre-function of the "custom" page and, in that function, call Abort in case you which to skip the page - as you are already doing. Otherwise, when you do not want to skip the page, you setup the custom page as usual. Though, one problem I see with your current "Download32bit" function seems to be that you always call Abort in the end - or do I miss something?

BTW: Please use [CODE] tags when pasting code

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 19th February 2014, 17:50   #3
jt9000
Junior Member
 
Join Date: Feb 2014
Posts: 5
I have updated the code to reflect what I currently have. It currently works by having a "pop up message" stating that 32 bit installer should be downloaded.

What I am looking for is something more elegant: a install page that has the download link included in the text body, and the user can click on exit to exit the installer. Is this possible to do?

Thanks
jt9000 is offline   Reply With Quote
Old 19th February 2014, 18:05   #4
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Why not use something like:

code:

Page custom Download32bitShow Download32bitLeave

Function Download32bitShow
# Skip the custom page, if running on a 64-Bit OS
${IfThen} ${RunningX64} ${|} Abort ${|}

# Set up the custom page here, as you would do normally
[...]
FunctionEnd

Function Download32bitLeave
# Exit installer when leaving the custom page
Quit
FunctionEnd


My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 19th February 2014, 18:20   #5
jt9000
Junior Member
 
Join Date: Feb 2014
Posts: 5
Thanks LoRd_MuldeR.

My remaining question is how can the body text of the custom page be inserted/edited? I couldn't find any examples online. Is there something similar to !insertmacro MUI_HEADER_TEXT, but for the body of the page?
jt9000 is offline   Reply With Quote
Old 19th February 2014, 18:23   #6
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
C'mon! You could at least have a look at the nsDialogs or InstallOptions tutorial

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 19th February 2014, 19:00   #7
jt9000
Junior Member
 
Join Date: Feb 2014
Posts: 5
I did look into nsDialogs, but thought there would be something right from MUI.

Thanks again.
jt9000 is offline   Reply With Quote
Old 19th February 2014, 19:19   #8
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Actually MUI2 makes use of the nsDialogs plug-in to create its built-in pages. MUI still used InstallOptions.

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 19th February 2014, 19:35   #9
jt9000
Junior Member
 
Join Date: Feb 2014
Posts: 5
I have everything working as I want it to now with nsDialogs!

Thanks again for your patience as I am brand new to NSIS.

Cheers!!
jt9000 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump