Archive: Program group


Program group
You know in some installs you get a page asking you to add the program to a group. Is there an NSIS page extant that I can use for this? Googled it but couldn't find any info.


When you say "program group", do you mean "start menu folder"? If so, have a look a the MUI/MUI2 docs regarding the start menu page. (There's also an example "StartMenu.nsi" located in ${NSISDIR}\Examples\Modern UI)

If that's not it, then perhaps attach an example of what you mean.


Thanks for the pointer. I don't want to be rude, because I love NSIS, but the documentation for MUI_PAGE_STARTMENU is lousy! What do the two parameters mean? I want to show the product name in the edit box on the dialog but I can only seem to get the path. I have tried these:

!insertmacro MUI_PAGE_STARTMENU "Application" $StartMenuFolder
!insertmacro MUI_PAGE_STARTMENU "Application" $INSTDIR
!insertmacro MUI_PAGE_STARTMENU $(PRODUCT_NAME) $INSTDIR
!insertmacro MUI_PAGE_STARTMENU "Application" $(PRODUCT_NAME)

And other variations. The only thing it liked for the second parameter was $INSTDIR - and then the whole path appears in the edit box. Arghh! Help! S.O.S.


It's all in the MUI docs! :weird:

I think the correct syntax would be:

Var $StartMenuFolder

...

!insertmacro MUI_PAGE_STARTMENU MyPageID $StartMenuFolder

...

Section "Shortcuts"
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Run My Application.lnk" "$INSTDIR\Program.exe"
SectionEnd



To configure the Startmenu page put these *before* the page macro:

!define MUI_STARTMENUPAGE_TEXT_TOP "$(PRODUCT_NAME)"
!define MUI_STARTMENUPAGE_TEXT_CHECKBOX "Checkbox text"
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "My Company\$(PRODUCT_NAME)"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKCU
!define MUI_STARTMENUPAGE_REGISTRY_KEY "SOFTWARE\My Company\$(PRODUCT_NAME)"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Startmenu"


And in your Uninstaller you would use:

Section Uninstall
...
!insertmacro MUI_STARTMENU_GETFOLDER MyPageID $0
Delete "$SMPROGRAMS\$0\Your Shortcut.lnk"
...
SectionEnd

If the only thing it accepted was $INSTDIR then you are missing Var StartMenuFolder.

Stu


What is the check box for? When I check it everything is grayed out. What's the point of that? What would the text typically be?

I get an error: LangString "PRODUCT_NAME" is not set in language table of language English

I have a !define for PRODUCT_NAME

Also the registry key - what would I put for "My Company"? My company or leave it for the user or what?

Help! Can't find any documentation on it!


Originally posted by richiebabes
What is the check box for? When I check it everything is grayed out. What's the point of that? What would the text typically be?

I get an error: LangString "PRODUCT_NAME" is not set in language table of language English

I have a !define for PRODUCT_NAME


Leran to search the docs :p

LangString is *not* !define :mad:

!define MyDefine "Some important string"

LangString MyLangStr ${LANG_ENGLISH} "Hello world!"
LangString MyLangStr ${LANG_GERMAN} "Hallo Welt!"

Section
DetailPrint "This is a define: ${MyDefine}"
DetailPrint "This is a localized string: $(MyLangStr)"
SectionEnd

Notice () versus {} !!!


Quote:

Originally posted by richiebabes
Also the registry key - what would I put for "My Company"? My company or leave it for the user or what?

Help! Can't find any documentation on it!
Make sure you use a unique Registry key!

And of course "My Company" was a placeholder ;)

An Example would be:
Software\PandeGroup\Folding@home\5.03

Thanks - I am the world's worst searcher of docs.


Examples can help a lot, if you don't like or don't have docs ;)

I recommand you have a deep look at:
NSIS\Examples\Modern UI\StartMenu.nsi


Where will I find this?

Software\PandeGroup\Folding@home\5.03


Originally posted by richiebabes
Where will I find this?

Software\PandeGroup\Folding@home\5.03
You won't find this on your system, unless you have installed Folding@Home. It was just an example :rolleyes:


However you can inspect the Registry via:
START -> Run -> "regedit"

Your entry would be located at:
My Computer > HKEY_CURRENT_USER > SOFTWARE > My Company > My Product

Note that "My Company" and "My Product" are placeholders for real names ;)

Still wondering about the check box. What's it for? If you check it then it grays out the area. What's the point of that? And what text would typically be put there? And would it typically be checked or unchecked on entering the dialog?


The user checks the checkbox if he doesn't want to have a StartMenu entry created. Otherwise he enters the name of the StartMenu folder he want's to have created by your installer. Use the provided macros to implement that behavior properly!

Var StartmenuFolder

...
MUI_PAGE_STARTMENU MyStartMenuPage $StartmenuFolder
...

Section "-Shortcuts"
...
!insertmacro MUI_STARTMENU_WRITE_BEGIN MyStartMenuPage
CreateFolder "$SMPROGRAMS\StartmenuFolder"
CreateShortcut "$SMPROGRAMS\StartmenuFolder\Shortcut.lnk" "$INSTDIR\Program.exe"
...
!insertmacro MUI_STARTMENU_WRITE_END
...
SectionEnd

...

Section "Uninstall"
...
!insertmacro MUI_STARTMENU_GETFOLDER MyStartMenuPage $R0
Delete "$SMPROGRAMS\$R0\Shortcut.lnk"
RMDir "$SMPROGRAMS\$R0"
...
SectionEnd

A thousand thanks. I am forever in your debt. :-)