WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > Unable to select sections without going to custom install
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
davidnewcomb
Junior Member

Registered: Nov 2006
From: Reading, UK

Unable to select sections without going to custom install

I have two sections "Install" and "Extract", and 7 sections.
"Extract" has 1 of the sections selected and this simply extracts the payload.
"Install" does a number of tests and depending on external conditions selects 1 to 6 of the sections.
I want to present the user with "Extract" or "Install". The user will not be able to change any of the sections selected.

Unfortunately, I keep running into problems. If I use SectionIn to designate which sections are assigned to an Install type, it switches to a 'Custom' Install option as soon as I change any of them. If I set the components page to use /NOCUSTOM then on loading it sets the Install component type to blank which disappears when I select another option.

I want it to appear with Install and all the required options preselected, so the user can just click next.

The example below is as close as I can get it The type of install is set to blank. When you manually set it to Install it sets the correct options, but this is an extra step which I am trying to get rid of.

!include Sections.nsh
!include MUI.nsh

Name InstTest
OutFile c:\InstText.exe
InstallDir C:\Data\QuentinV3


InstType "Install"
InstType "Extract"
InstType /NOCUSTOM

!insertmacro MUI_PAGE_COMPONENTS

Section "Install Java SDK" sec_install_java
SectionIn ro 1
SectionEnd

Section "Install MySQL database server" sec_install_mysql
SectionIn ro 1
SectionEnd

Section "ISA Manager" sec_install_isa
SectionIn ro 1
SectionEnd

Section "Configure Database" sec_config_db
SectionIn ro 1
SectionEnd

Section "Update Quantel database" sec_config_update
SectionIn ro 1
SectionEnd

Section "Downdate Quantel database" sec_config_downdate
SectionIn ro 1
SectionEnd

Section "File Extract Only" sec_extract_only
SectionIn ro 2
SectionEnd

Function .onInit
!insertmacro ClearSectionInInstType "${sec_install_java}" "${INSTTYPE_1}"
!insertmacro ClearSectionInInstType "${sec_config_update}" "${INSTTYPE_1}"
!insertmacro SetSectionInInstType "${sec_extract_only}" "${INSTTYPE_2}"
FunctionEnd

Quick Link | Report this post to a moderator | IP: Logged

davidnewcomb is offline Old Post 12-19-2006 05:58 PM
Click Here to See the Profile for davidnewcomb Click here to Send davidnewcomb a Private Message Find more posts by davidnewcomb Add davidnewcomb to your buddy list Edit/Delete Message Reply w/Quote
Red Wine
Forum King

Registered: Mar 2006
From: Ath. GR

I guess this is what you're looking for :-)

code:
!define SF_USELECTED 0 !define SF_SELECTED 1 !define SF_RO 16 Name InstTest OutFile 'InstText.exe' InstType "Install" InstType "Extract" InstType /NOCUSTOM !include MUI.nsh !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_LANGUAGE "English" Section "Install Java SDK" SEC_1 ;;;;;;;;;;;;;; SectionEnd Section "Install MySQL database server" SEC_2 ;;;;;;;;;;;;;; SectionEnd Section "ISA Manager" SEC_3 ;;;;;;;;;;;;;;; SectionEnd Section "Configure Database" SEC_4 ;;;;;;;;;;;;; SectionEnd Section "Update Quantel database" SEC_5 ;;;;;;;;;;;;;; SectionEnd Section "Downdate Quantel database" SEC_6 ;;;;;;;;;;;;; SectionEnd Section "File Extract Only" SEC_7 ;;;;;;;;;;;;;; SectionEnd Function .onInit # execute at least this sample script twice by changing the Push below # respectively to contition1 contition2 and watch the action :-) Push contition1 Pop $R0 StrCmp $R0 'contition1' contition1 contition2 contition1: IntOp $0 ${SF_SELECTED} | ${SF_RO} SectionSetFlags ${SEC_1} $0 SectionSetInstTypes ${SEC_1} 1 SectionSetFlags ${SEC_5} $0 SectionSetInstTypes ${SEC_5} 1 IntOp $0 ${SF_USELECTED} | ${SF_RO} SectionSetFlags ${SEC_2} $0 SectionSetFlags ${SEC_3} $0 SectionSetFlags ${SEC_4} $0 SectionSetFlags ${SEC_6} $0 IntOp $0 ${SF_USELECTED} | ${SF_RO} SectionSetFlags ${SEC_7} $0 SectionSetInstTypes ${SEC_7} 2 contition2: StrCmp $R0 'contition2' 0 exit IntOp $0 ${SF_SELECTED} | ${SF_RO} SectionSetFlags ${SEC_1} $0 SectionSetInstTypes ${SEC_1} 1 SectionSetFlags ${SEC_5} $0 SectionSetInstTypes ${SEC_5} 1 SectionSetFlags ${SEC_2} $0 SectionSetInstTypes ${SEC_2} 1 SectionSetFlags ${SEC_3} $0 SectionSetInstTypes ${SEC_3} 1 IntOp $0 ${SF_USELECTED} | ${SF_RO} SectionSetFlags ${SEC_4} $0 SectionSetFlags ${SEC_6} $0 IntOp $0 ${SF_USELECTED} | ${SF_RO} SectionSetFlags ${SEC_7} $0 SectionSetInstTypes ${SEC_7} 2 exit: FunctionEnd

__________________
Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS

Quick Link | Report this post to a moderator | IP: Logged

Red Wine is offline Old Post 12-19-2006 10:36 PM
Click Here to See the Profile for Red Wine Click here to Send Red Wine a Private Message Find more posts by Red Wine Add Red Wine to your buddy list Edit/Delete Message Reply w/Quote
davidnewcomb
Junior Member

Registered: Nov 2006
From: Reading, UK

Wow thanks, You have obviously put in a lot of work for this.
It took quite a long time to understand how it works so I will add an explaination for others.

The reason why my orginal showed blank in the selection list was because the selected sections did not match any of the predefined install types.

After a bit of fiddling I found SetSectionInInstType in sections.nsh and wrote 2 macros to help standardise the SectionSet stuff.

code:
!macro AssignInstallSection P_SEC Push $0 IntOp $0 ${SF_SELECTED} | ${SF_RO} SectionSetFlags ${P_SEC} $0 Pop $0 !macroend !macro UnassignInstallSection P_SEC Push $0 IntOp $0 ${SF_USELECTED} | ${SF_RO} SectionSetFlags ${P_SEC} $0 Pop $0 !macroend Function .onInit !insertmacro SetSectionInInstType ${sec_install_java} 1 !insertmacro AssignInstallSection ${sec_install_java} !insertmacro ClearSectionInInstType ${sec_install_mysql} 1 !insertmacro UnassignInstallSection ${sec_install_mysql} !insertmacro ClearSectionInInstType ${sec_install_isa} 1 !insertmacro UnassignInstallSection ${sec_install_isa} !insertmacro ClearSectionInInstType ${sec_config_db} 1 !insertmacro UnassignInstallSection ${sec_config_db} !insertmacro SetSectionInInstType ${sec_config_update} 1 !insertmacro AssignInstallSection ${sec_config_update} !insertmacro ClearSectionInInstType ${sec_config_downdate} 1 !insertmacro UnassignInstallSection ${sec_config_downdate} !insertmacro SetSectionInInstType ${sec_extract_only} 2

Quick Link | Report this post to a moderator | IP: Logged

davidnewcomb is offline Old Post 12-20-2006 02:28 PM
Click Here to See the Profile for davidnewcomb Click here to Send davidnewcomb a Private Message Find more posts by davidnewcomb Add davidnewcomb to your buddy list Edit/Delete Message Reply w/Quote
Red Wine
Forum King

Registered: Mar 2006
From: Ath. GR

Υou're welcome!. Nice job from your side!
Perhaps you may want to take a look at the attached below sample. I think it is a little more pro looking :-)

Attachment: test.nsi
This has been downloaded 420 time(s).

__________________
Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS

Last edited by Red Wine on 12-20-2006 at 03:52 PM

Quick Link | Report this post to a moderator | IP: Logged

Red Wine is offline Old Post 12-20-2006 02:54 PM
Click Here to See the Profile for Red Wine Click here to Send Red Wine a Private Message Find more posts by Red Wine Add Red Wine to your buddy list Edit/Delete Message Reply w/Quote
davidnewcomb
Junior Member

Registered: Nov 2006
From: Reading, UK

Maybe 1 for the Wiki!

Quick Link | Report this post to a moderator | IP: Logged

davidnewcomb is offline Old Post 12-20-2006 06:11 PM
Click Here to See the Profile for davidnewcomb Click here to Send davidnewcomb a Private Message Find more posts by davidnewcomb Add davidnewcomb to your buddy list Edit/Delete Message Reply w/Quote
Red Wine
Forum King

Registered: Mar 2006
From: Ath. GR

I've already posted a topic at wiki with the above sample code because here in forum after a few days is not easy to find it by someone who might need it.

__________________
Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS

Last edited by Red Wine on 12-20-2006 at 07:49 PM

Quick Link | Report this post to a moderator | IP: Logged

Red Wine is offline Old Post 12-20-2006 06:18 PM
Click Here to See the Profile for Red Wine Click here to Send Red Wine a Private Message Find more posts by Red Wine Add Red Wine to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 09:21 AM. Post New Thread    Post A Reply
  Last Thread   Next Thread
WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > Unable to select sections without going to custom install
Show Printable Version
 | 
Email this Page
 | 
Subscribe to this Thread

Forum Jump:
 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is off
vB code is ON
Smilies are ON
[IMG] code is ON