Archive: Two Difference Ordering and Twto Difference Results


Two Different Ordering and Two Different Results With the Same Code
I've been trying to compile an installer for a few days with NSIS and today i've came accross an interesting thing.

Written two scripts with same code but different ordering. I mean:
The first one is like this:
;------
General things
;------
Pages
;------
Installer Sections
;------
Functions


The second one is like this:
;------
General things
;------
Pages
;------
Functions
;------
Installer Sections


In the first one, radio buttons work but some functions don't work.

In the second one, all the functions work but radio buttons don't work.

Is this a bug or did i do something wrong? Please check the package in the attachment out.


When you use:

Section "something" "blah"
the compiler creates a constant named "blah" with the index of the section. That constant can be used only after it's defined in the script, just like any other define. For example, this will also fail:
Name "${blah}"
!define blah "my program"
Why the functions would fail, I can't see right away. Can you be a bit more specific about this failure?

Please see line 62 in "01.nsi"
You'll notice "$yol" variable. With some functions, installer read an ini file and return with a value to make installer determine an installation path for some files. This path is stored in "$yol" variable. I'd like to use this to install some of files to special path according to a ".ini" file.

As i said on the first post, this doesn't work on 01.nsi. But when i changed ordering of lines it works properly as you can see in 02.nsi.

On the other hand when i changed ordering, in this time, radio buttons don't work.

I'M really confused about that... :(


There shouldn't be any order-related problem with that function. Are you sure it's not because the incorrect value is saved in the registry key specified by InstallDirRegKey? Try commenting out the InstallDirRegKey line and bring it back only when everything else works.


I've removed all the installdirregkey line and try but same thing was happened. I think it's a bug. Because all codes are same. The only difference is ordering of some lines...

Please take one of these .nsi file and compile it. After compiled, copy all the "functions" (or sections may be) related lines and paste to one part lower or upper in same file. I hope i could tell what i meant.

If you think this is not a bug, can you please make 01.nsi file work? (with radio buttons feature and all functions)


Well, I compiled it and got the warning explaining it all:

unknown variable/constant "Yol\Opera\Opera\Profile\toolbar" detected, ignoring (F:\Temp\WinTemp\01.nsi:61)
Yol is not defined at that point of the script. Move `Var Yol` to the top of the script.

The Functions will break if you move them above the Sections because they use constants defined by the Section instructions themselves...

This line:
StrCpy $1 ${FGVar} ; Group 1 - Option 1 is selected by default
It contains the ${FGVar} constant which is defined by the Section instruction. It contains the index of that Section.

Edit:
Also what Kichik said ^^ :)

-Stu


Oh, thank you! You are great :up:
It works now, everthing is allright ;)