Archive: how to skip a page "next" or "back"


how to skip a page "next" or "back"
I have this order:

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE
Page custom find_xyz
!insertmacro MUI_PAGE_COMPONENTS

But when cklicking "back" from components i get everytime the custom page (which is only on "next" useful) - so i want to skip this page and want go straight to the license page.

how can i do this


Set a variable when entering components page and check to see if that variable is set in the xyz show function if so abort loading it. Note you will need to unset the variable when entering license page so that page xyz can be displayed again when next is clicked on the license page.

Vytautas


Nice idea but i do not work till now:


!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE
Page custom findabsfreset
Page custom findabsf
!insertmacro MUI_PAGE_COMPONENTS

...

Section "${MUI_PRODUCT} ${MUI_VERSION}" SecInfo0
;this skipps the findabsf message on "back" to license page
StrCpy $1 "skip"
SectionEnd

...

Function findabsfreset
;this enables the findabsf message on "back" to license page
StrCpy $1 ""
FunctionEnd


...

Function findabsf
StrCmp $1 "skip" 0 +2
return
;other stuff
FunctionEnd


Wrong variable or wrong way!?

Try abort insta=ead of return e.g.:

Function findabsf
StrCmp $1 "skip" 0 +2
abort
;other stuff
FunctionEnd
If still no luck i'll post a working script based on a example from nsis.

Vytautas

The problem was the variable - i use $R1 now:


!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE
Page custom findabsfreset
Page custom findabsf
!insertmacro MUI_PAGE_COMPONENTS

[the part from SECTION was dropped to the FUNCTION below]

...

Function findabsfreset
;this enables the findabsf message on "back" to license page
StrCpy $R1 ""
FunctionEnd

Function findabsf
StrCmp $R1 "skip" 0 +2
return
;other stuff

;this skipps the findabsf message on "back" to license page
StrCpy $R1 "skip"
FunctionEnd


thx for impoving my nsis skill :)

i simplified code:


!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE
Page custom findabsf
!insertmacro MUI_PAGE_COMPONENTS

...

Function findabsf
StrCmp $R1 "skip" 0 +3
StrCpy $R1 ""
return
;other stuff

;this skipps the findabsf message on "back" to license page
StrCpy $R1 "skip"
FunctionEnd


The only problem may be not to interfere with other routines that uses $R1.

A more elegant way of achieving this is shown here ;)

  !insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE
Page custom find_xyz
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES

!define MUI_CUSTOMFUNCTION_COMPONENTS_PRE PreC
!define MUI_CUSTOMFUNCTION_LICENSE_PRE PreL
Function find_xyz
StrCmp $R1 "skip" end 0 ; This must be before the following line
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioA.ini"
; rest of code for custom page
end:
FunctionEnd

Function PreL
StrCpy $R1 ""
FunctionEnd

Function PreC
StrCpy $R1 "skip"
FunctionEnd
Hope this helps.

Vytautas

[EDIT]
Brummelchen posted the previous post quicker that me and it's an even better solution, although both will work well. Also you need to make sure that the "!insertmacro MUI_INSTALLOPTIONS_DISPLAY ..." line is after the comparison

Vytautas
[/EDIT]

As far as I know only $9, used in MUI with StartMenu Plugin, is used by NSIS installer unless you use them in your own custom functions :p

Vytautas


> !define MUI_CUSTOMFUNCTION_COMPONENTS_PRE PreC
> !define MUI_CUSTOMFUNCTION_LICENSE_PRE PreL

Nice solution - didnt know about that feature

But why this one?
> !insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioA.ini"

i am not familiar with IO yet.

PS $R1 is not used so far in my script - and when - it is pushed before (functions)


I thought that "!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioA.ini"" line was needed to display the IO page. Unless it has changed in the last week or so. Note: "ioA.ini" is the filename of IO layout file.

Check out the ModernUI Readme file for the full list of callback functions, e.g. all pages have a PRE, SHOW and LEAVE function.

Vytautas


i found it - sure it is the more elegant way :)


!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE

!insertmacro MUI_PAGE_COMPONENTS
!define MUI_CUSTOMFUNCTION_COMPONENTS_PRE findcomp ; two func = one func now

...

Function findcomp
;skip if this part was already used
StrCmp $R1 "skip" 0 +3
return

...

;this skipps the found message on "back" or "next"
StrCpy $R1 "skip"
FunctionEnd


i did so to avoid annoying clicking when the decision was made (more comfotable)

Thank you very much.

Glad I could help.

Vytautas