Archive: Stop Install files process and display finish page


Stop Install files process and display finish page
  Hi

Is is possible to force stopping the Install file section and jump immediately to the finish page?

tx

Oren


Calling abort will stop the installer:


Section

SendMessage $HWNDPARENT 0x408 1 0;Hack to move to the next page
Abort
SectionEnd
>
...but, this means the install has been aborted and the only thing the user can do is to close the installer.

If you want to continue doing stuff after the stop, you can't call abort. You can emulate the abort with some ugly code:


abortedhack

>!macro BeginAbortableSection
StrCmp $abortedhack"" 0 abortedhack_end
>!macroend
>!macro EndAbortableSection
goto abortedhack_end
abortedhack_stop:
>SetAutoClose true
StrCpy $abortedhack 1
abortedhack_end:
!macroend
>!macro StopInstall
goto abortedhack_stop
>!macroend


Section
>!insertmacro BeginAbortableSection

MessageBox mb_yesno"Stop?" IDNO nope
>!insertmacro StopInstall
nope:

!insertmacro EndAbortableSection
SectionEnd


Section
>!insertmacro BeginAbortableSection

MessageBox mb_yesno"Stop?" IDNO nope
>!insertmacro StopInstall
nope:

!insertmacro EndAbortableSection
SectionEnd
>

Hi
abort is no good for me as I want to exit the installer gracefully.

I can see what you mean.
Your code enforce all code must be place within the section (either explicitly or implicitly by using macros). This is because of the

Goto abortedhack_end
placed at the end of each section.

The problem is I have lots of functions being called from the sections. how (and if) can I Goto this label from within a "called function"

I saw Goto can also get a var. I actaually do not really understand yet what does it do - but maybe this can help?

tx

Originally posted by jammusi
The problem is I have lots of functions being called from the sections. how (and if) can I Goto this label from within a "called function"
When you want to 'abort', set a variable and jump to the end of your function. After each function call, check that variable and if it's set jump to end of your section.

thanks mate.

Ya I know this option but I prefer to achieve it in the easy way. without lots of code modifications...

Seems like there is no such a way

tx

Oren


You can also call Return from functions to exit them early (without using the Goto).

Edit: However, as long as you skip over those function calls then why do you need to have this code in the functions?

Stu


Thanks.

If I skip the functions i do not need the "Return" within the functions

I will try to explain again what I need. I have a pretty complex scripts with lots of functions, macros, and commands (i.e ${MyCommand})

Currently whenever the setup encounters an unexpected error which can not be processed - a central function to roll back all operations already been taken by the setup is being called.
than the user is informed and the script is Aborted.

What I need is to terminate the setup in a more friendly way - by displaying the finish page.

The question is how can i achieve that?
One possible way, as suggested, is to check and handle status status variable that should be checked before calling to each function or within the functions

Is there an easier way - that will solved me the necessity to modify a lot of code.

tx