Archive: Add Check for Flash Function in Modern UI flow example


Add Check for Flash Function in Modern UI flow example
Can someone give me an example of how I can insert a page after the license page that checks for Flash using the below function:

Function IsFlashInstalled
Push $R0
ClearErrors
ReadRegStr $R0 HKCR "CLSID\{D27CDB6E-AE6D-11cf-96B8-444553540000}" ""
IfErrors lbl_na
StrCpy $R0 1
Goto lbl_end
lbl_na:
StrCpy $R0 0
lbl_end:
Exch $R0
FunctionEnd

I am having a little trouble with it. Do I use an *.ini, just a message box? I am pretty new at this so please give me an example. I attached my *.nsi file.


You could do it with an INI or just a message box. Although you did mention you wanted a page which would require an INI file. You could do it with a message box using the function,

MUI_CUSTOMFUNCTION_LICENSE_LEAVE

Check out the Modern UI docs for more details. Add

!define MUI_CUSTOMFUNCTION_LICENSE_LEAVE myLicensePgLeave

to your script. Then add the leaving license page function and make it something like this. I pretty much just made it pseudo code to give you an idea of what it might look like.

Function myLicensePgLeave
IsFlashInstalled

; If it is then display message box A

; If not then display message box B
FunctionEnd


Why check after the license is shown? If you want to check before the license is shown do it in .onInit or .onGUIInit (if you're using the MUI see the MUI readme before you try using .onGUIInit).

If you want to show a page then you need an INI file and InstallOptions. Take a look at the InstallOptions.nsi example in Examples\Modern UI.

Ignore what's below in the little writing, it's just another solution that isn't possible yet.

You might also consider putting the warning in the welcome page. For that you'd have to change the text in it. To do that you need to define a pre function for the welcome page (!define MUI_CUSTOMFUNCTION_WELCOME_PRE myFunction), and in that function write to the INI file the values you need (use the MUI_INSTALLOPTIONS_WRITE macro, for example: !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 2" "Text" "Flash is not installed... bla bla bla"). You should also define a leave function for the welcome page so the user won't be able to leave it and continue the installtion. I'm afraid this is not yet possible...