Each section has its own description. But, each section really has it's own .nsh file and so the section is not located within the main .nsi.
I am trying to localize section properties. One of the properties being the description for the section.
e.g. 10 sections make 10 nsi files. The main nsi script holds a reference to each nsh file because of a description. Is it possible to bypass this?
I'd really like to localize each sections description to it's own nsh file. Instead of having descriptions all bunched up at the bottom of the main nsi. I'd like to get them divided and put into their corresponding nsh file.
Does this make sense? Is this possible? I would really appreciate any help on this. Thanks!
PS. I've already applied "8. Section descriptions of the MUI readme". This is close but no cigar.
How to localize !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN to it's very own NSH file
9 posts
You can have a macro like the following to insert in each .nsh:
Before you start including your .nsh files, use this:!macro desc sec text
!system 'echo !insertmacro MUI_DESCRIPTION_TEXT ${sec} \
"${text}" >> $%TEMP%\descs.nsh'
!macroend
And after you finish including the .nsh files, use this:!system 'echo !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN > $%TEMP%\descs.nsh'
Finally, to get the descriptions into your script, use:!system 'echo !insertmacro MUI_FUNCTION_DESCRIPTION_END >> $%TEMP%\descs.nsh'
!include $%TEMP%\descs.nsh
Thank you for the reply Kichik. I am sorry but I just cannot get it to work. Here is how I tried to apply it.
This is what the main .nsi looks like.
Thank you very much for your time and help on this question.
This is what the main .nsi looks like.
The following piece of code you've supplied I think might have me confused and hitting a dead end.!system 'echo !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN > $%TEMP%\descs.nsh'
!include "include\sample.nsh"
!include "include\example.nsh"
!system 'echo !insertmacro MUI_FUNCTION_DESCRIPTION_END >> $%TEMP%\descs.nsh'
!include $%TEMP%\descs.nsh
I've placed it at the top and tried it at the bottom of the nsh. I've renamed ${sec} & ${text} to ${sectionname} & ${sectiondescription}. I've placed my!macro desc sec text
!system 'echo !insertmacro MUI_DESCRIPTION_TEXT ${sec} \
"${text}" >> $%TEMP%\descs.nsh'
!macroend
!insertmacro MUI_DESCRIPTION_TEXT ${sectionname} "$(sectiondescription)"within, above and below the macro. Man, I've tried a few things and searched the web. Can you help provide an example or correct me where I've gone wrong?Thank you very much for your time and help on this question.
!system 'echo !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN > $%TEMP%\descs.nsh'Probably this line should have ">>" instead of ">".
Thanks for that fast reply and sharp eagle eye deguix.
Now I know this little change made a big impact because
I currently cannot compile 🙁
Here is some of the verbose error feedback
the following
Now I know this little change made a big impact because
I currently cannot compile 🙁
Here is some of the verbose error feedback
I assume the error on line 3 for the macro is!system: "echo !insertmacro MUI_FUNCTION_DESCRIPTION_END >> C:\DOCUME~1\VICTOR~1.GON\LOCALS~1\Temp\descs.nsh"
!system: returned 0
!include: "C:\DOCUME~1\VICTOR~1.GON\LOCALS~1\Temp\descs.nsh"
!insertmacro: MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro: end of MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro: MUI_FUNCTION_DESCRIPTION_END
!insertmacro: end of MUI_FUNCTION_DESCRIPTION_END
!insertmacro: MUI_FUNCTION_DESCRIPTION_BEGIN
Error: Function named ".onMouseOverSection" already exists.
Error in macro MUI_FUNCTION_DESCRIPTION_BEGIN on macroline 10
!include: error in script: "C:\DOCUME~1\VICTOR~1.GON\LOCALS~1\Temp\descs.nsh" on line 3
Error in script "C:\Documents and Settings\Victor B. Gonzalez\Desktop\Example\Copy of nsissource1.7 (template).nsi" on line 62 -- aborting creation process
The line in the main nsi (62) which causes the error is1. !macro desc sec text
2. !system 'echo !insertmacro MUI_DESCRIPTION_TEXT ${sec} \
3. "${text}" >> $%TEMP%\descs.nsh'
the following
Can you help school me on the problem? Thank you very much!61. !system 'echo !insertmacro MUI_FUNCTION_DESCRIPTION_END >> $%TEMP%\descs.nsh'
62. !include $%TEMP%\descs.nsh
OK, I've managed to find out what the problem is. It seems everytime the following code is called
What I've done was, I opened the temporary file in question and deleted it's contents. Ran the script again (error free), and the temporary file looked perfect.
The latest problem though is although everything looks good, script runs fine, the temporary file looks perfect, something is not working. I say this because when I hover over the description in the final installer, I see no description 🙁
Any Ideas? Thank you for your time 🙂
The temporary file created will not delete itself. Neither can another call to the code reset the temporary file. What seems to happen is, is when the code is called, the script will append itself to itself again. This leads to the error.!system 'echo !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN >> $%TEMP%\descs.nsh'
!include "example.nsh"
!system 'echo !insertmacro MUI_FUNCTION_DESCRIPTION_END >> $%TEMP%\descs.nsh'
!include $%TEMP%\descs.nsh
What I've done was, I opened the temporary file in question and deleted it's contents. Ran the script again (error free), and the temporary file looked perfect.
The latest problem though is although everything looks good, script runs fine, the temporary file looks perfect, something is not working. I say this because when I hover over the description in the final installer, I see no description 🙁
Any Ideas? Thank you for your time 🙂
I got it to work. I simply replaced the location of the following code snippet "!include $%TEMP%\descs.nsh". I placed it where descriptions normally go and all seems to work fine now. Thanks a million for your help fellas!
deguix, it should be >, not >>. If it's >>, it will simply append and not replace. That's why you began to get errors, vbgunz. As for the macro, by inserting a macro, I meant using !insertmacro, not actually inserting the macro itself in every .nsh file. But I guess you've already figured that one out since it's working now.
Awesome! > Vs >> is true. Although >> Helped me troubleshoot the problem somewhat 😉 Thanks a million Kichik, thats powerful!