Skip to content
⌘ NSIS Forum Archive

Start Menu question

5 posts

SteveAtkinson#

Start Menu question

Sorry if this has been answered a bazliion times, but I have been searching the docs and google for a while and cant find the answer.

I want to modify my install script so that it asks if the user would like to add a start menu shortcut for their own menu or for all users. I can see how to make the change to current/all but not how to get that info from the user.

I've inherited a project and this is the first time I've had to mess with install scripts.

Thanks for your help!
Afrow UK#
Either use InstallOptions:

[Settings]
NumFields=3

[Field 1]
Type=Label
Left=0
Right=-1
Top=0
Bottom=24

[Field 2]
Type=RadioButton
Left=30
Right=-1
Top=50
Bottom=58
State=1
Flags=GROUP

[Field 3]
Type=RadioButton
Left=30
Right=-1
Top=70
Bottom=78
State=0
Or use a MessageBox!

Stu
SteveAtkinson#
well I'm a total noob to the nsis scripting, I'd imagined that this would be a "standard feature" of an installer, it must be a very common request. I was kinda hoping for a simpler answer, but I'll have a look at the custom message box. It just feels "clumsy" seeing as you already have a very nice dialog box (MUI_STARTMENU)

I'd like to add another question if I may regarding "AddSize"

The script includes a check for .Net Framework 2.0 which, in a greatly simplified form, is shown below.

The problem is, the size is getting added whether or not .Net is isnatlled. Why is this and how can I fix it?


Section "Microsoft .NET Framework v2.0"
SectionIn RO
Call GetDotNETVersion
Pop $0
${If} $0 == "not found"
goto lbl_StartInstallNotFound
${EndIf}
# version check snipped
goto lbl_Done

lbl_Confirmed:
AddSize 153600
nsisdl::download \
/TIMEOUT=30000 "http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe" "$PLUGINSDIR\dotnetfx.exe"
# more snippage

lbl_done:
SectionEnd

Afrow UK#
AddSize is a compile time instruction and therefore cannot be jumped over at run time. Use SectionSetSize instead.

MessageBoxes are very easy to use. As for a standard feature, using InstallOptions is very easy, so you could turn it into a macro for others to use.

Stu
SteveAtkinson#
Thanks Afrow, I've been messing with it and sorted the AddSize out by modifying my .onInit and checking there if .Net is installed, and if so, doing a SectionSetSize.

I hadn't intended getting this deep into the nitty-gritty of NSIS but it's kinda fun. At least now I can close one of our TRAC tickets 🙂