Archive: Flow control outside of a function using MUI?


Flow control outside of a function using MUI?
Noob alert - apologies in advance.

I'm using the modern UI to make an installer which does not use or modify the registry in any way...

I'm trying a simple detection for a previous version of my software. The installer calls a custom page:
!insertmacro MUI_PAGE_DIRECTORY
Page custom PrevInst
!insertmacro MUI_PAGE_INSTFILES

Function PrevInst simply looks for an important file from my package on the users hard drive in the folder chosen to install to. If the file exists, a message box is invoked giving options to install there anyway (YES), quit (CANCEL), or go back and choose the install destination again (NO). Therein lies the problem. I can't figure out how to control the flow outside of the function to invoke !insertmacro MUI_PAGE_DIRECTORY again, and I have no clue how to embed this routine in the MUI_PAGE_DIRECTORY macro, though I suspect that's what I need to do...

Any suggestions?

Thanks in advance!



!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "checkFile"
!insertmacro MUI_PAGE_DIRECTORY

Function checkFile
IfFileExists "$INSTDIR\a_file.ext" +3
MessageBox MB_OK|MB_ICONSTOP "File missing!"
Abort
FunctionEnd


Abort when called in a page's PRE function skips that page.
Abort when called in a page's LEAVE function will go back to that page.

-Stu

Thanks for the quick service! Much obliged.

Best,
sg


This was exactly what I was looking for. Thanks for this.

However, I there's one detail I'm not quite happy with yet.

I want to create an installer/upgrader. The user chooses whether they wish to install or to upgrade. If they upgrade, I wish to show a second INSTFILES page.

I've got this working with:

!define MUI_PAGE_CUSTOMFUNCTION_PRE ShouldIUpgrade
!insertmacro MUI_PAGE_INSTFILES

Function ShouldIUpgrade
IntCmp $upgradeInstall 1 skip
abort
skip:
FunctionEnd

Which works, only if the user is not seeing this page, i.e. abort is called, they still need to click a button, even though the page isn't shown. Thus there's an extra click that shouldn't be there.

So, it seems that 'abort' in a PRE skips the page, but not the page's buttons.

Any thoughts? Am I missing something obvious?

Upayavira


I think you need to set SetAutoClose true first.

-Stu


Thanks stu, works a treat!

Upayavira