Custom Dialog that allows user to specify a folder - Advanced Installer Community
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Custom Dialog that allows user to specify a folder

Hi,
I have looked at the "Browse for folder" tutorial and it helped me a good bit, but I have a slightly more advanced scenario that I could use some help with, please:

I have a "Select Reports folder" dialog with a single PathEdit control and the typical "Browse..." button.

The property value for the PathEdit should be get it's initial value from one of two scenarios:
a) if the User.INI file is found, then get the [Paths] Reports key value from the ini file
b) if the User.INI file is _not_ found, then use a hard-coded (typical) path such as this: "[PublicDocuments]\[ManufacturerName]\[ProductName]\Reports\"

How can I set this up? I have a Install Parameters > Property defined called "REPORTS_DEFAULT_FOLDER" and it's value is defined as "[PublicDocuments]\[ManufacturerName]\[ProductName]\Reports\". And that seems to be working out so far, but when I click the Next > button the installation and look at the results I'm not getting that folder created.

How do I create the folder location for that scenario?
And how do I make sure that the INI file's [Paths] Reports key value is updated to match that folder location? (currently it's not using the good value that I see on screen for the folder location it's instead creating an INI file entry that includes the APPDIR path instead, like this: Reports=C:\Program Files (x86)\ProMicro\Overture Demo\REPORTS_DEFAULT_FOLDER\ which is wrong on two counts 1) it shouldn't be in APPDIR at all and 2) the REPORTS_DEFAULT_FOLDER is a variable/property value and it's putting in the literal string "REPORTS_DEFAULT_FOLDER")

Thanks.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Custom Dialog that allows user to specify a folder

Hello Kevin,
How can I set this up? I have a Install Parameters > Property defined called "REPORTS_DEFAULT_FOLDER" and it's value is defined as "[PublicDocuments]\[ManufacturerName]\[ProductName]\Reports\". And that seems to be working out so far, but when I click the Next > button the installation and look at the results I'm not getting that folder created.
Please note that the Value field from the edit property dialog is Pseudo-fromatted. Please keep in mind that properties referenced by PseudoFormatted data types are resolved at build time while properties referenced by Formatted data types are resolved at runtime.
a) if the User.INI file is found, then get the [Paths] Reports key value from the ini file
In the Search page you can create a InI search.
Then you can go in the Custom Actions page and add the predefined Set installer property custom action with sequence after the "Wizard Dialogs Stage -> Searches" action group.
You can edit its properties like that:
  • Property: REPORTS_DEFAULT_FOLDER (defined in the "InstallParameters" page)
    Value: [RESULT_PROPERTY] (this is the default property name which has been assigned to the Search operation)
    Condition: RESULT_PROPERTY
2) if the User.INI file is _not_ found, then use a hard-coded (typical) path such as this: "[PublicDocuments]\[ManufacturerName]\[ProductName]\Reports\"
In order to achieve that you can go in the Custom Actions page and add the predefined Set installer property custom action with sequence after the "Wizard Dialogs Stage -> Searches" action group.
You can edit its properties like that:
  • Property: REPORTS_DEFAULT_FOLDER (defined in the "InstallParameters" page)
    Value: [PublicDocumentsFolder]\[Manufacturer]\[ProductName]\Reports
    Condition: NOT RESULT_PROPERTY (the name of the search operation)
If you want to install files in a custom folder, you can go in the Files and folders page and add a property based folder. Property based folders will be resolved at install time to the values from the respective property.
You can also take a look on the How do I install files in a custom folder? article with related information for hints and guidance.

Please let us know if that helped, otherwise give us more details about your specific scenario.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Re: Custom Dialog that allows user to specify a folder

Hi Dan,
I followed your suggested steps and the folder is still not being created the way that I would expect.

And, I am still getting bad entries in the INI file. Like I mentioned before the INI is updated to this:

Code: Select all

Reports=C:\Program Files (x86)\ProMicro\Overture Demo\REPORTS_DEFAULT_FOLDER\ 
which is wrong on two counts:
1) it shouldn't relate back to the APPDIR at all, it should be point to whatever the user selected in the "Select Default folder" screen
2) plus, the REPORTS_DEFAULT_FOLDER is a variable/property value and it's putting in the literal string "REPORTS_DEFAULT_FOLDER")

in either case it should be something like the (real) path to:
Reports=[PublicDocumentsFolder][PM_ManufacturerShortName]\[ProductName]\Reports
or
Reports=C:\Users\Public\Documents\ProMicro\Overture Demo\Reports


I think the best thing is probably to send you my AIP file so I'm going to do that now.
Thanks.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Custom Dialog that allows user to specify a folder

Hi Kevin,

Please note that you have defined for the .ini file operation to be executed when Create only if it does not exist in the Edit INI Entry Dialog.

So, can you please select the Create or update action and see if the behavior persist? If it does, can you please send us a verbose log of the installation process to support at advancedinstaller dot com so we can investigate it?

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Re: Custom Dialog that allows user to specify a folder

Hi Dan,
Thanks, I changed both of those INI settings to "Create or update" as you will see in the AIP that I am sending (with verbsose log) and I still find that the default folders are not being created as we would expect.

Thanks.

Return to “Common Problems”