happilybottled
19th May 2004 23:17 UTC
Skip instfiles page
I am writing an installer that needs to have 2 instfiles pages, one of which may be skipped. My problem is that I cannot get the installer to skip an instfiles page - if I put an 'Abort' in the pre-function then the page comes up blank but it is not skipped.
I know that this is usually done by showing a components page and allowing the user to pick what components they want to install, but for marketing/licensing reasons I need to do it this way.
The flow of the installer needs to be like:
Page custom PageWantProductA
Page instfiles PreProductA PageProductA LeaveProductA
Page custom PageProductAInstallationResults
Page license
Page directory
Page instfiles PreProductB PageProductB LeaveProductB
Function PageWantProductA
; A page that asks the user if they want
; product A installed
FunctionEnd
Function PreProductA
; If the user wants product A, then unselect all
; sections except those for Product A
; If the user does not want product B, then skip
; this page
FunctionEnd
Function PageProductA
FunctionEnd
Function LeaveProductA
; unselect the product A sections, and select
; the product B sections
FunctionEnd
Function PageProductAInstallationResults
; tell the user Product A was installed sucessfully
; (or if it failed)
FunctionEnd
deguix
20th May 2004 02:38 UTC
What I think you should do is to create an invisible custom page after the instfiles page and try to use abort command again on instfiles pre-function. Say after if this works or not.
happilybottled
20th May 2004 16:24 UTC
OK, I don't know exactly what you mean by an invisible page, so I don't know how to try it. I do have some custom pages that should sometimes get skipped, and these pages are behaving exactly as I expect.
If I put the 'Abort' in the pre function, then I see a blank page rather than having the page skipped. I then have to click next. Neither the 'show' nor the 'leave' functions ever get called in this case, and after I click next I go to the next page I expect to see.
If I try putting the 'Abort' in the show function, then the leave function gets called immediately but I still have to click next to get to the next page. The install page that I see in this case says 'Completed' and when I click on details all it says is 'Completed' (nothing is actually installed) and the progress bar has made no progress (it appears as just a white strip).
In either of these cases I've tried putting in custom pages before and after the install page, and I've tried skipping those pages and showing those pages - these custom pages always behave as expected and never have any effect on this observed behavior of the install page.
deguix
21st May 2004 01:20 UTC
An invisible custom page is a page which doesn't appear on the screen. Use "Page custom CustFunc" after instfiles page and create "Function CustFunc" with no commands inside (CustFunc is the name of the function you want), and add to instfiles pre-function the command Abort. Try and say if it does work.
roy204
21st May 2004 13:03 UTC
Hi there,
I work with "happilybottled" and tried your suggestion of an invisible custom page this morning but it didn't fix it. The new page doesn't show (that's expected) but also does not change the logic (I'm not sure how it could) of other pages.
All in all, we are unable to skip the instfiles page using Abort in the pre_function, nor stay into it using Abort in the leave_function although it works with every other page type (license, components, etc...).
Could this be a bug in NSIS or is there a workaround?
Thanks again for any help, much appreciated.
pengyou
21st May 2004 22:55 UTC
You can use "SetAutoClose true" and "SetAutoClose false" inside your sections to control whether or not the first instfiles page appears.
happilybottled
24th May 2004 16:54 UTC
Thank you pengyou! It looks like I can get the behavior I want by combining SetAutoClose and Abort. (If I don't use Abort then the 'Next >' button does work correctly, but the '< Back' button on the next page still ends up getting me to the install page I was trying to skip.)