Hi, my installer is structured such that:
1. Prerequisites are checked
2. Needed prerequisites are Downloaded
3. Needed prerequisites are Installed
4. Installation of my application.
However, the problem I'm having is this:
I have written various macros to detect these prerequisites, and in these macros I use the SelectSection macros. The *PROBLEM* is that, because my sections appear later in the code, the SelectSection macros give me this error:
unknown variable/constant "{MUI_LANGDLL_PUSHLIST}" detected, ignoring (macro:MUI_LANGDLL_DISPLAY:24)
unknown variable/constant "{sec_i_MSI}" detected, ignoring (macro:UnSelectSection:3)
unknown variable/constant "{sec_i_MSI}" detected, ignoring (macro:UnSelectSection:5)
unknown variable/constant "{sec_i_MSI}" detected, ignoring (macro:SelectSection:3)
unknown variable/constant "{sec_i_MSI}" detected, ignoring (macro:SelectSection:5)
How can I circumvent this error? I feel like I'm missing something fairly obvious.
Thanks,
Ogden
FYI my script looks like this...
...preambles and such
Section "-Windows Installer Check"
!insertmacro CheckWindowsInstaller
(which contains calls like
!insertmacro UnSelectSection ${sec_i_MSI})
SectionEnd
...
;Dialogs and whatnot
...
Section "Windows Installer 3.1" sec_i_MSI
SectionIn RO
DetailPrint "MSI 3.1"
SectionEnd
...rest of the installation
SelectSection Circular Reference problem
11 posts
hi ogden_ogly,
you may have to do following things
1. write to registry if the macro1, macro2, etc are passed without any error code
2. read this status entry(ies) from registry and
3. use logiclib.nsh
to form code as below
ReadRegStr $0 HKLM "Software\MySoft\Macro1" "Installed"
${If} $0 = "1" ;$0 is satus for macro1 read from registry.
!insertmacro CheckWindowsInstaller
${EndIf}
you may have to do following things
1. write to registry if the macro1, macro2, etc are passed without any error code
2. read this status entry(ies) from registry and
3. use logiclib.nsh
to form code as below
ReadRegStr $0 HKLM "Software\MySoft\Macro1" "Installed"
${If} $0 = "1" ;$0 is satus for macro1 read from registry.
!insertmacro CheckWindowsInstaller
${EndIf}
You can use the values of the section indexes only after the Section mySection SEC000 declaration, not before.
bholliger:
Thanks for the reply. I tried adding:
Section NoCode SEC000
push $0
pop $0
sectionend
To the top of the script, it didn't seem to help resolve anything. Any thoughts?
Thanks for the reply. I tried adding:
Section NoCode SEC000
push $0
pop $0
sectionend
To the top of the script, it didn't seem to help resolve anything. Any thoughts?
Simply put the code of the first section in a function and call that function from the section. Put that function after the definition of the second section and you're set.
n_baua:
While this is certainly possible, I don't think its a real solution. There *HAS* to be a way to set a section on or off *before* you've reached it? Otherwise would be madness.
While this is certainly possible, I don't think its a real solution. There *HAS* to be a way to set a section on or off *before* you've reached it? Otherwise would be madness.
Hi ogden_ogly,
Yes, you are correct, but I also had faught on this for a long time, didn't had much time to research at that time, so adopted the registry logic. It works fine for me.
Yes, you are correct, but I also had faught on this for a long time, didn't had much time to research at that time, so adopted the registry logic. It works fine for me.
The reason why this has to be done this way is that the compiler creates defines for each section index.
And you can't use a define before it has been created.
Have a look at NSIS Manual, Chapter 4, 4.6.1.2 Section.
And you can't use a define before it has been created.
Have a look at NSIS Manual, Chapter 4, 4.6.1.2 Section.
Looks like it's time for a 2-pass compiler 🙂
Hi!
I think a solution would be to scan the source file and create the defines on top of the file.
1. Save createsectiondefines.nsi to the folder and compile it.
2. Save this
3. Put this in the project
A sample:
Well, it's just an idea. What do you think?
Cheers
Bruno
I think a solution would be to scan the source file and create the defines on top of the file.
1. Save createsectiondefines.nsi to the folder and compile it.
2. Save this
to the file sectiondefcreator.nsh to the folder
!macro SECTIONDEFCREATOR FILE
!system "createsectiondefines.exe /file ${FILE}"
!include sectiondefs.nsh
!macroend
3. Put this in the project
This creates a file sectiondefs.nsh that is included into the project with the definitions for every section. Due to the fact that the sections are simply counted from 0 to (SECTIONCOUNT-1) this should work.!include sectiondefcreator.nsh
!insertmacro SECTIONDEFCREATOR ${__FILE__}
A sample:
Creates a definition named CC_SEC01 that can be used before the sections compilation.
Section "My Section" SEC01
Well, it's just an idea. What do you think?
Cheers
Bruno
bholliger
This seems to work quite well! I think I owe you a beer 🙂
This seems to work quite well! I think I owe you a beer 🙂