l_d_allan
28th January 2006 17:53 UTC
More descriptive names with InstallOptions?
Is there a way to use more descriptive names with the InstallOptions .ini file?
Rather than "Field 1", "Field 2", etc., is it possible to use "Support_X", "Support_Y", etc.?
<edit>:
The purpose is to be able to use the meaningful field name in the .nsi file .... something such as
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field Support_X" "State"
or
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Support_X" "State"
rather than the cryptic
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 2" "State"
</edit>
From the test.ini example:
[Settings]
NumFields=2
[Field 1]
Type=radiobutton
Text=Install support for X
Left=10
Right=-10
Top=17
Bottom=25
State=0
Flags=GROUP
[Field 2]
Type=radiobutton
Text=Install support for Y
Left=10
Right=-10
Top=30
Bottom=38
State=1
Flags=NOTABSTOP
Afrow UK
28th January 2006 18:29 UTC
No need just put a comment in there.
Anything after a ; on a new line is a comment and will be ignored by the parser.
-Stu
l_d_allan
28th January 2006 19:28 UTC
I'm not sure I understand your answer (but my question wasn't that clear ... mea culpa)
What I want to be able to do is use the more descriptive names in the .nsi file, rather than the rather meaningless "Field 2" reference.
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Support_X" "State"
or
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field Support_X" "State"
rather than the crypic
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 2" "State"
Afrow UK
29th January 2006 10:36 UTC
Again, that is what comments are for really.
The fields are named that way ("Field #") so that the plugin can iterate through the Sections easily.
-Stu
Comm@nder21
29th January 2006 16:45 UTC
you can do that with defines in the script :)
!define SUPPORT_X "Field 1"
and then use ${SUPPORT_X} anywhere in the script.
bholliger
29th January 2006 16:45 UTC
Hi!
Use !define to map descriptive names to "Field X" names. If you change your UI in the future, you only have to change the constants.
-Bruno.
Comm@nder21
29th January 2006 17:29 UTC
lol, posted same idea at the same time :)
german and switzerland, dreamteam ;)
bholliger
29th January 2006 17:36 UTC
rofl! Great coincidence!
l_d_allan
31st January 2006 20:47 UTC
!define SUPPORT_X "Field 1"
and then use ${SUPPORT_X} anywhere in the script.
Thanks for the info .... I had tried different combinations, but not that one .... but I found there was one more thing to do ... enclose in quotations
!define SUPPORT_X "Field 1"
WriteINIStr "$PLUGINSDIR\test.ini" "${SUPPORT_X}" "State" 1