Archive: Getting "Don't place shortcuts" checkbox's state


Getting "Don't place shortcuts" checkbox's state
How do I get the state of the "Don't place shortcuts" checkbox in the MUI Startmenu page? I want to know so that my page, which allows the user to set which shortcuts he wants created, only shows up when that checkbox isn't checked.


The Start Menu folder variable will be prefixed with a '>' character.


Re: Getting "Don't place shortcuts" checkbox's state
Hello everybody.

Bringing up a very old thread.

> The Start Menu folder variable will be prefixed with a '>' character.

How do I read out the "Start Menu folder variable" when I'm not anymore in the start menu dialog?

I want to put a URL entry to the start menu at the very end of the installation, but only if the user didn't check the "Don't place shortcuts" checkbox.

Any hint very much appreciated.


You provide the variable (MUI_PAGE_STARTMENU pageid variable)

Ignoring the user is evil, why would you want to do this?


Re: Getting "Don't place shortcuts" checkbox's state
Hello Anders,

thank you very much for your reply.

> You provide the variable (MUI_PAGE_STARTMENU pageid variable)

Excuse my ignorance, but I'm not yet familliar with NSIS speak. What do you mean by this?

I could do
!insertmacro MUI_STARTMENU_GETFOLDER Application $0

but I always get "MyApp" and never ">MyApp", regardless if I checked the "Don't place shortcuts" checkbox or not.

> Ignoring the user is evil, why would you want to do this?

Huh?

That's exactly what I don't want to do, ignoring the user. I want to find out if he checked the box or not and ONLY create the URL shortcut, if he didn't.


Originally posted by AldoRay
Huh?

That's exactly what I don't want to do, ignoring the user. I want to find out if he checked the box or not and ONLY create the URL shortcut, if he didn't.
If the checkbox is not checked you should not add anything to the startmenu, that is the whole point of the checkbox.

Using $0 is not a good idea, make your own variable with Var.

MUI_STARTMENU_GETFOLDER is for the uninstaller, in the installer you can just check the variable directly.

Hi Anders,

again thank you for your quick reply.

Originally posted by Anders
If the checkbox is not checked you should not add anything to the startmenu, that is the whole point of the checkbox.
This must be a misunderstanding. Again: the reason to check the checkbox variable is to NOT install the URL startmenu link in that case.

Originally posted by Anders
Using $0 is not a good idea, make your own variable with Var.
Understood.

Originally posted by Anders
MUI_STARTMENU_GETFOLDER is for the uninstaller, in the installer you can just check the variable directly.
Sorry to be so ignorant :o How would I do that?

Yeah, a misunderstanding about the checkbox state, sorry about that.

Anyway, to check the variable just copy the first character into $0 with StrCpy and then compare $0 with ">". The reason > is used is because it is invalid in a path, so even without checking first, a call to createshortcut or writeinistr will just fail...


Originally posted by Anders
Yeah, a misunderstanding about the checkbox state, sorry about that.
Never mind. It's me who is asking questions about basic stuff :o

Originally posted by Anders
Anyway, to check the variable just copy the first character into $0 with StrCpy and then compare $0 with ">". The reason > is used is because it is invalid in a path, so even without checking first, a call to createshortcut or writeinistr will just fail...
That's clear to me, thank you. What is still not clear to me is what this does mean:

Originally posted by Anders
You provide the variable (MUI_PAGE_STARTMENU pageid variable)
What would I really write in my NSIS script to retreive the variable?

Would I write

var /GLOBAL MuiPageStartMenuFolder
StrCpy $MuiPageStartMenuFolder "${MUI_STARTMENUPAGE_pageid_VARIABLE}" 1


Hm, I guess that won't work :down:

Got it:

${MUI_STARTMENUPAGE_Application_VARIABLE}


Thank you Anders!

Why are you making this so hard? :)

var /GLOBAL StartMenuFolder
...
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
...
StrCpy $0 $StartMenuFolder 1
StrCmp $0 ">" ...