I've tried to put logic in to the NSIS script I'm writing to see if ActiveSync is installed, and to either display an error message if it's not found, or continue. However, it seems NSIS doesn't have any support for flow control during the "wizard" portion of the installer, only during installation itself: When I try to compile the script, it tells me the (jump target) labels can only be used inside a function or a section. Sections are installation code blocks that are executed after the UI finishes. Functions cannot be called except from inside a function or a section - so they're effectively only available in the post-UI phase, too.
Is there no way to have flow control during the UI phase of NSIS operation, or am I missing something?
UI flow control : function / label use outside sections ??
11 posts
You need to insert your code into a Pre or Leave function of one of the Installer Pages.
-Stu
-Stu
ok, that will work. having the page code buried inside insertmacro statements makes that option rather less obvious, but now that you've pointed it out, I'm quite certain I can figure out how to do it 😎
Well, you're using MUI right, so...
-Stu
This will call the 'CheckActiveSync' function just before the Components Page.
!define MUI_PAGE_CUSTOMFUNCTION_PRE CheckActiveSync
!insertmacro MUI_PAGE_COMPONENTS
Function CheckActiveSync
...
FunctionEnd
-Stu
I go to the grocery store and I come back and find my code written for me!
🙂 🙂 🙂 🙂
FWIW, I'll actually be putting the function call before MUI_PAGE_DIRECTORY, but that doesn't change your example significantly.
Thanks, you've saved me a bunch of time!
👍
🙂 🙂 🙂 🙂
FWIW, I'll actually be putting the function call before MUI_PAGE_DIRECTORY, but that doesn't change your example significantly.
Thanks, you've saved me a bunch of time!
👍
Couldn't you just use:
Function .onInit
Call CheckActiveSync
FuntionEnd
Originally posted by flyakiteNot when you are using the modern ui
Couldn't you just use:
Function .onInit
Call CheckActiveSync
FuntionEnd
I think you're wrong. I'm using Modern UI, and this is in my .onInit
call CheckSP1
and this is my CheckSP1 function:
call CheckSP1
and this is my CheckSP1 function:
and here is code DIRECTLY in my .onInit obtained from the Archive using a jump:
Function CheckSP1
ReadRegStr $R3 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CSDVersion
StrCmp $R3 "Service Pack 1" "" +2
Return
MessageBox MB_OK "You do not have Windows XP Service Pack 1 installed.$\n$\n Make sure to choose the 'Extract Files Only' install type when installing."
FunctionEnd
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "72") i .r1 ?e'
Pop $R0
StrCmp $R0 0 +3
MessageBox MB_OK "The installer is already running."
Abort
flyakite is 100% correct.
.onInit can most certainly be called when using MUI.
It's .onGUIInit which has been taken over by MUI.
In that case you have to !define MUI_CUSTOMFUNCTION_GUIINIT if you want to do any special GUI initialization steps.
.onInit can most certainly be called when using MUI.
It's .onGUIInit which has been taken over by MUI.
In that case you have to !define MUI_CUSTOMFUNCTION_GUIINIT if you want to do any special GUI initialization steps.
I tend not to use .onInit for long calculations or file searches etc, as the user may think the installer has crashed.
If you do though, make sure you use the banner plugin to display a message.
-Stu
If you do though, make sure you use the banner plugin to display a message.
-Stu
I tend not to use .onInit for long calculations or file searches etc, as the user may think the installer has crashed.I was exactly talking about this in other forums, because I done it in the past, and so were the users complaining about the installer...
If you do though, make sure you use the banner plugin to display a message.