graham.reeds
26th October 2007 10:33 UTC
Conditional Section
I need to have a section where it detects whether an older version of our application has been installed and if so present the user an additional options page, but only present that page if the an older version has been detected.
Now I've managed to do the detection via simple looking for where the old registry settings would be kept (we've been bought so the registry settings, program locations, etc. are moving to be inline with the parent firm) but need to a) perform the detection somewhere, and b) only appear if the detection is true.
If it helps I am using HM NIS Edit and select ModernUI 2.
I did a search for Conditional Pages and came up with 3 results none of which helped me out. I am fairly sure I saw something in the online manual when I was checking into NSIS about it but can't find it now.
Thanks, G.
Afrow UK
26th October 2007 10:56 UTC
It's pretty easy.
!include LogicLib.nsh
Page Custom OldVersionPage OldVersionPageLeave
Function OldVersionPage
${If} [some condition]
Abort ; Skip the page.
${EndIf}
FunctionEnd
Stu
graham.reeds
26th October 2007 16:56 UTC
Checking the error flag
Thanks.
I have one other question. I am writing a registry value so that if the installer has already ported across the original settings it won't do it again.
So I look at ReadRegDword for checking if the setting has been there. According to the documentation "The error flag will be set and $x will be set to an empty string ("" which is 0) if the DWORD is not present."
It seems to me that it would be better check the error flag than simply checking to see whether the string is empty. Searching the manual two error results: !error and exit error levels, nothing about the error flag. How do you check the error flag?
Thanks, Graham Reeds
graham.reeds
26th October 2007 17:05 UTC
Stop the press - found the answer in an older thread.
graham.reeds
26th October 2007 17:05 UTC
Stop the press - found the answer in an older thread.