Archive: create custom aborted installation page


create custom aborted installation page
I am trying to create a custom finish page which basically should say that the installation was aborted, and the application is not installed.

I am current using the predefined pages like welcome,install files and finish.

I want to use a finish page template to display this message.

i know i can create a page using Page custom, but this does not allow me to show the page only when the user clicks cancel in the middle of the install wizard.

how do i make NSIS to show a page only when the user clicks cancel install?


You can try UltraModernUI that featured an abort page


You can create two custom pages, one for success and one for abort.
Then use the callback functions .onInstFailed and .onInstSuccess to show the right custom page.
(http://nsis.sourceforge.net/Docs/Cha...html#4.7.2.1.3)

JP


Function .onInstFailed
MessageBox MB_OK "Better luck next time."
FunctionEnd

This allows me to show a message dialog.....not declare a page and go into that flow of execution.

if i declare the page after the finish page in my declaration, if i click on finish i am getting redirected to the custom page instead of exiting the installer.

can you please tell me how we can create a page and not show it unless we call for it specifically?


You're right.
Well, you can create a global variable, and change the value in the .onInstFailed function.
Then compare the variable in the init function of the two custom pages, and call Abort in the Init function you don't need.

Like:


var /Global failedinstall

Function .onInit
StrCpy failedinstall "false"
FunctionEnd

Function .onInstFailed
StrCpy failedinstall "true"
FunctionEnd

Function SuccessFinishPage
StrCmp failedinstall "true" +2
Abort
'successfinishpage code
FunctionEnd

Function FailedFinishPage
StrCmp failedinstall "false" +2
Abort
'failedfinishpage code


Something like this
(I was not able to test this code, because I don't have installed NSIS on the machine I'm currently using, so there might be errors, but you get the idea)

JP
FunctionEnd

Originally posted by jpderuiter
You're right.
Well, you can create a global variable, and change the value in the .onInstFailed function.
Then compare the variable in the init function of the two custom pages, and call Abort in the Init function you don't need.

Like:

var /Global failedinstall

Function .onInit
StrCpy failedinstall "false"
FunctionEnd

Function .onInstFailed
StrCpy failedinstall "true"
FunctionEnd

Function SuccessFinishPage
StrCmp failedinstall "true" +2
Abort
'successfinishpage code
FunctionEnd

Function FailedFinishPage
StrCmp failedinstall "false" +2
Abort
'failedfinishpage code


Something like this
(I was not able to test this code, because I don't have installed NSIS on the machine I'm currently using, so there might be errors, but you get the idea)

JP
FunctionEnd
I think it will be work well.Base on custom page.
But it can't automaticall chang the language when I select other installing language.

Originally posted by jpderuiter
You're right.
Well, you can create a global variable, and change the value in the .onInstFailed function.
Then compare the variable in the init function of the two custom pages, and call Abort in the Init function you don't need.

Like:

var /Global failedinstall

Function .onInit
StrCpy failedinstall "false"
FunctionEnd

Function .onInstFailed
StrCpy failedinstall "true"
FunctionEnd

Function SuccessFinishPage
StrCmp failedinstall "true" +2
Abort
'successfinishpage code
FunctionEnd

Function FailedFinishPage
StrCmp failedinstall "false" +2
Abort
'failedfinishpage code


Something like this
(I was not able to test this code, because I don't have installed NSIS on the machine I'm currently using, so there might be errors, but you get the idea)

JP
FunctionEnd
I tried something like that, if i try to put in the "Page custom [creator function]" in a function it gives me the error
"command Page not valid in Function" so i guess it has problem with page declaration within a function.

There must be some clean way of implementing this kinda behavior, it can't be so uncommon.....

You don't actually specify the "Page" command; just the commands that create the dialog. However, I don't think you -can- create a dialog in the userAbort callback (seems to be okay in .onInstFailed, but that's not what you're looking for, I think).

So you may just have to use something like...
http://nsis.sourceforge.net/Go_to_a_NSIS_page
...to go to a particular page.. your 'user aborted' page that checks whether the user aborted (set a variable). If the user didn't abort installation, just abort that page so it never displays.

Might be worth investigating UMUI if you need this functionality :)


The thing I didn't think of was that (custom) pages are not called as soon the installer is aborted.
So my code will never work.

As far as I can see UMUI is the way to go.


well, the...
http://nsis.sourceforge.net/Go_to_a_NSIS_page
...page specifically deals with the user abort event (Standard and MUI), so that might be an option as well.


Well, as it says:

Use it only on normal functions, the ".onUserAbort" callback function (w/o MUI) or the !define MUI_CUSTOMFUNCTION_ABORT "Function" (w/ MUI)
I suppose you can't use it for .onInstFailed.

not sure - but in the case of .onInstFailed, I could successfully pop up a dialog (nsDialogs) anyway, so it wouldn't be needed there.


Thanks for your help ppl :)

For my functionality atleast i think the combined solution of
jpderuiter and Animaether will work.

I just create a custom page and check in the creator function if i need to show the page or just call abort in the creator function to continue on with the other pages.

i thought of using the same, but figured it is a round about way of doing this.(still noob at NSIS i guess :) )