cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Jesper_Eskilson
Level 3

Changing start menu folder name

Hi,

How do you use the SelectFolder() dialog to allow the user to select the name of the folder in the start menu where the programs shortcuts are placed, in such a way that I can use the automation/COM interface to add such shortcuts. For example, if I put the following in the OnFirstUI() function:

nResult = SelectFolder("Title", "Default folder", szFolderName);
...
CreateProgramFolder(szFolderName);

Then how do I place shortcuts in that folder using the COM interface?

folder = ???
folder.AddShortcut("my shortcut")

Somehow I must refer to the result from the SelectFolder() dialog, but how? Is it possible to do something like this:

folder = project.ISWiFolders.Item("").SubFolders.Item("").SubFolders.Item("").SubFolders.Item("")
folder.AddShortcut(...)

I find it a little strange that this would be so difficult, I imagined that it would be a standard option to add a folder selection wizard.
Labels (1)
0 Kudos
(4) Replies
RobertDickau
Flexera Alumni

Before going down that road, is it an option for you to use the graphical Shortcuts view and use SHELL_OBJECT_FOLDER as the subfolder name, and at run time set SHELL_OBJECT_FOLDER to the value you obtain from SelectFolder or SdSelectFolder? You can then sidestep the need to add the shortcut to your project during each build...
0 Kudos
Jesper_Eskilson
Level 3

RobertDickau wrote:
Before going down that road, is it an option for you to use the graphical Shortcuts view and use SHELL_OBJECT_FOLDER as the subfolder name, and at run time set SHELL_OBJECT_FOLDER to the value you obtain from SelectFolder or SdSelectFolder? You can then sidestep the need to add the shortcut to your project during each build...


Using the graphical interface to add the shortcuts is not an option; the entire installation is generated automatically from a specification file.

I need to be able to add the shortcut using the automation interface in a way that the name of the shortcut folder can be determined at runtime. I'm not sure if/how I can use SHELL_OBJECT_FOLDER to accomplish that.
0 Kudos
RobertDickau
Flexera Alumni

As another option to avoid the extra step of using Automation for the shortcut, can you use AddFolderIcon in the script (after CreateProgramFolder) to create the shortcut in the user's selected location?
0 Kudos
Jesper_Eskilson
Level 3

In theory, yes, but I would need to automatically generate installscript code to do this, and that is simply too much work to be worth it. Fortunately, our product manager agreed to remove the need for changing the folder name, so this is no longer an issue.

I still find it curious that a common operation such as changing the name of the program folder at runtime is not possible to do using the automation interface.
0 Kudos