This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Creating Custom ProgramFiles folder
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 17, 2015
09:40 AM
Creating Custom ProgramFiles folder
I am using Installshield 2014 and im working in an Installscript MSI Project. I am also new to Installshield and working with a demo to learn the application. Help is greatly appreciated
[LIST=1]
I am creating a simple install that contains the "SelectFolder" dialog BEFORE the "SdAskDestination" dialog
The user can either take the defaulted Program Folder, which i have set OR create their own folder name
Once the user sets their custom name and clicks Next, they see the "SdAskDestination" dialog. The path is updated and correctly display the custom folder name the user entered in the previous step
Once the installation takes place, all the shortcuts get installed into the default folder name that was set NOT the custom name the user entered into the "SelectFolder" dialog.
From what i can see in the help docs, the "CreateProgramFolder" function must be created in a custom script and executed in sequence. I am unsure how to do this so far or maybe im missing a step somewhere else.
Where do i go from here?
Thanks
[LIST=1]
Where do i go from here?
Thanks
(11) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 18, 2015
09:48 PM
PlinyElder wrote:
I am using Installshield 2014 and im working in an Installscript MSI Project. I am also new to Installshield and working with a demo to learn the application. Help is greatly appreciated
[LIST=1]I am creating a simple install that contains the "SelectFolder" dialog BEFORE the "SdAskDestination" dialog The user can either take the defaulted Program Folder, which i have set OR create their own folder name Once the user sets their custom name and clicks Next, they see the "SdAskDestination" dialog. The path is updated and correctly display the custom folder name the user entered in the previous step Once the installation takes place, all the shortcuts get installed into the default folder name that was set NOT the custom name the user entered into the "SelectFolder" dialog. From what i can see in the help docs, the "CreateProgramFolder" function must be created in a custom script and executed in sequence. I am unsure how to do this so far or maybe im missing a step somewhere else.
Where do i go from here?
Thanks
With InstallScript MSI it's not enough to only call SelectFolder. You also need to set the value for the new folder name. There are a couple of ways to do it, but probably the easiest is to use the MsiSetProperty InstallScript function to set the value for your Start Menu folder:
In the above screenshot the SelectFolder and MsiSetProperty functions are being called directly before the SdAskDestPath function (in the OnFirstUIBefore function).
In order for this to work, your Start Menu folder must be a Public Property (all uppercase letters in the Directory column of the Directory table). Otherwise Windows Installer will ignore your new folder name (because MSI "private properties" throw away their value and re-initialize using their default value when switching from Immediate Mode to Deferred Mode).
To make that more clear, here's what my Directory table looked like when I created my Start Menu folder:
Notice in the screenshot above that the name in the Directory column of the Directory table contains lowercase letters. That makes it a Windows Installer "private property", which is a big problem if the goal is to alter the folder name.
So I performed a search-and-replace in the Direct Editor view and made sure that it used only uppercase letters (which makes it a Windows Installer "public property"):
Performing those steps should allow the user to modify the name of the Start Menu folder. Note: You may need to also take steps to guarantee that the uninstall properly removes the shortcut and Start Menu folder, otherwise they may get orphaned.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 20, 2015
09:59 AM
Evan Border wrote:
With InstallScript MSI it's not enough to only call SelectFolder. You also need to set the value for the new folder name. There are a couple of ways to do it, but probably the easiest is to use the MsiSetProperty InstallScript function to set the value for your
Performing those steps should allow the user to modify the name of the Start Menu folder. Note: You may need to also take steps to guarantee that the uninstall properly removes the shortcut and Start Menu folder, otherwise they may get orphaned.
So this works perfectly except when it comes to the uninstalling of the shortcuts/start menu folder(Which you noted). So do i need custom script to handle the uninstall process or can the uninstaller reference that Public Property using an "Add File Removal" process?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 20, 2015
02:07 PM
PlinyElder wrote:
So this works perfectly except when it comes to the uninstalling of the shortcuts/start menu folder(Which you noted). So do i need custom script to handle the uninstall process or can the uninstaller reference that Public Property using an "Add File Removal" process?
Yes, I would typically record the user's custom folder choice in a registry entry and have the uninstall read that registry entry. No custom action is needed...you should be able to use Windows Installer's built-in System Search capability to read in the registry (where you stored the custom folder name) Ex:
As long as you are setting the property to the same name as the directory table entry (NEWFOLDER1 in my example), Windows Installer handles the rest for you.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 28, 2015
10:41 AM
OK, thank you for the info. I havent gotten to try this yet but i am not in the world of the Advanced Suite UI. So if i am trying to do this in the Advance Suite then i have to add the MSI package that contains the installation of my application. BUT is the secondary MSI aware of the Suite UI folder selection?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 29, 2015
02:45 PM
PlinyElder wrote:
OK, thank you for the info. I havent gotten to try this yet but i am not in the world of the Advanced Suite UI. So if i am trying to do this in the Advance Suite then i have to add the MSI package that contains the installation of my application. BUT is the secondary MSI aware of the Suite UI folder selection?
If you're using a suite and having the user choose their custom start menu folder name via a Suite dialog, you'll want to pass that as a command line option to your MSI. In my example, I made sure that the folder was a MSI public property (named NEWFOLDER1), so I would have the suite call my MSI and add "NEWFOLDER1=[whatever variable name my Suite is using for the custom folder that the user chose]"
So you'd go to the Property Manager view in your Suite and add whatever property name you want to use for that, setting it to a reasonable default value. You'd then set up a custom dialog in the Wizard Interface view that makes use of that property. On the Packages view, you'd add a command line to your MSI that makes use of the property.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 14, 2015
03:04 PM
So sorry to bring this back up but im trying to do this in pure Installscript and its not working. Im guessing because its using MsiSetProperty in a non MSI project?
How can i set the custom folder when in an Installscript project?
How can i set the custom folder when in an Installscript project?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 14, 2015
11:58 PM
PlinyElder wrote:
So sorry to bring this back up but im trying to do this in pure Installscript and its not working. Im guessing because its using MsiSetProperty in a non MSI project?
How can i set the custom folder when in an Installscript project?
Just get rid of that MsiSetProperty command. It's only for InstallScript MSI's.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 15, 2015
09:57 AM
FeatureSetTarget can be used to set folder paths. Note that this function works for both InstallScript and InstallScript MSI projects.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 15, 2015
09:58 AM
Evan Border wrote:
Just get rid of that MsiSetProperty command. It's only for InstallScript MSI's.
So i must still be missing something. Since the MsiSetProperty is now gone, how am i pushing this value back to the entry in my Directory table? In my Directory table i have a value called 'NEWFOLDER' with a generic defaultdir called 'MyApp' but in my Installscript code there is not a way that i see to reference or set the value for 'NEWFOLDER'. My call to SelectFolder is as follows:
nResult = SelectFolder(szTitle, svDefGroup, svResultsFolder);
When the installation is run, doesn't matter what the user enters for the start menu folder name the folder is ALWAYS created as 'MyApp'
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 15, 2015
01:03 PM
joshstechnij wrote:
FeatureSetTarget can be used to set folder paths. Note that this function works for both InstallScript and InstallScript MSI projects.
I'm not getting the desired result from trying to set the ProgramFiles folder path with FeatureSetTarget. :confused:
Dlg_SdSelectFolder:
nResult = SelectFolder(szTitle, svDefGroup, svValue);
FeatureSetTarget( MEDIA, "", svValue );
if ( nResult = BACK ) goto Dlg_SdFeatureTree;
My Directory Table below:
My Folder im trying to have the dynamic name on:
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 18, 2015
10:06 AM
So i ended up figuring this out after about 4 days of working on it. This is the method that i used:
Works perfectly without having to create custom code for uninstall. Its all handled automatically by the installer
- Setup Design View - Click the shortcuts Folder
- Create new Programs Menu Folder
- In the new folder, set the Display Name property to
- In my installscript code set the SHELL_OBJECT_FOLDER variable to svResultFolder
Works perfectly without having to create custom code for uninstall. Its all handled automatically by the installer