Gridley
24th May 2005 20:20 UTC
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!
Afrow UK
24th May 2005 20:54 UTC
!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
Gridley
24th May 2005 22:04 UTC
Thanks for the quick service! Much obliged.
Best,
sg
Upayavira
25th May 2005 10:04 UTC
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
Afrow UK
25th May 2005 11:18 UTC
I think you need to set SetAutoClose true first.
-Stu
Upayavira
25th May 2005 11:28 UTC
Thanks stu, works a treat!
Upayavira