aalyam
Posts: 6
Joined: Sun Apr 25, 2021 10:56 pm

Choose value in xml and put in registry

Wed Apr 28, 2021 3:24 am

Good day. Is it possible to implement this scenario:
There are 2 msi files (opentextenterprisescan.msi + plugin.msi)
After install opentext enterprise scan, users can import configurations from xml-file (img.1). User can choose configurations only needed for him (img.2). It creates registry key in HKCU (img.3)

But I need to create this reg-keys in HKLM.
I created exe project with 2 chained packages in AI. And I create dialog window with checkboxes where users can mark the required configurations

How to bind checkbox property with value from xml file? And how based on the user's choice, add the required registry value to HKLM?
Attachments
3.png
3.png (101.8 KiB) Viewed 5309 times
2.png
2.png (330.76 KiB) Viewed 5320 times
1.png
1.png (113.8 KiB) Viewed 5320 times
Last edited by aalyam on Wed Apr 28, 2021 9:34 pm, edited 1 time in total.

Catalin
Posts: 4324
Joined: Wed Jun 13, 2018 7:49 am

Re: Choose value in xml and put in registry

Wed Apr 28, 2021 5:37 pm

Hello and welcome to our forums,
After install opentext enterprise scan, users can import configurations from xml-file (img.1). User can choose configurations only needed for him (img.2). It creates registry key in HKCU (img.3)
It is not quite clear to me through what is the user importing the configurations from the XML file? Is it through another application?
How to bind checkbox property with value from xml file?
This could be done by adding the XML file in your Advanced Installer project (in the Windows Installer format) and then condition the installation of the node using the checkbox. For instance, let's consider the following XML file:

Code: Select all

<note>
  <to>Everybody</to>
  <from>Catalin</from>
  <heading>Reminder</heading>
  <body>Don't forget me this weekend!</body>
</note>
You can condition each node (e.g. the "to" node) based on whether the checbox is checked or not. This way, the final XML file will only contain the settings selected by the user in your dialog.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

aalyam
Posts: 6
Joined: Sun Apr 25, 2021 10:56 pm

Re: Choose value in xml and put in registry

Wed Apr 28, 2021 9:34 pm

Catalin wrote:
Wed Apr 28, 2021 5:37 pm
It is not quite clear to me through what is the user importing the configurations from the XML file? Is it through another application?
the user imports the configuration in the installed OpenText Enterprise Scan application: Tools-Import Confuguration
cmdline: C:\Program Files\OpenText\Scan\bin\ScanCfgFromFile.exe "<full_path_to_xml>" {true|false}

Catalin
Posts: 4324
Joined: Wed Jun 13, 2018 7:49 am

Re: Choose value in xml and put in registry

Tue May 04, 2021 5:35 pm

Hello,

Thank you for your followup on this.

I see, so the import is done through a custom tool.

To be fully honest with you, I do not really see an easy way to achieve this.

Assuming the XML file is delivered with the setup package, you can try to create a custom action that will import the XML elements based on the user's choice in your custom dialog.

Due to the fact that the custom action is reliant on the XML file, it should be scheduled after the "Add Resources" action group with its' execution time being "When the system is being modified (deferred)".

Hope this helps somehow!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

aalyam
Posts: 6
Joined: Sun Apr 25, 2021 10:56 pm

Re: Choose value in xml and put in registry

Wed May 05, 2021 1:34 am

1. may i use checklist instead checkboxes?

2. I can set a condition for a registry key as a component. how to set a condition for a registry branch.

Catalin
Posts: 4324
Joined: Wed Jun 13, 2018 7:49 am

Re: Choose value in xml and put in registry

Mon May 10, 2021 6:06 pm

Hello,
1. may i use checklist instead checkboxes?
Sure!

The CheckList control is a regular list box with check-boxes.

For more information about a listbox, please refer to the following article:

Working with Windows Installer ComboBox and ListBox controls
2. I can set a condition for a registry key as a component. how to set a condition for a registry branch.
I am not quite sure I understand what you want to achieve here. Could you please give me some more details?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

aalyam
Posts: 6
Joined: Sun Apr 25, 2021 10:56 pm

Re: Choose value in xml and put in registry

Thu May 13, 2021 9:48 am

i decided not to use xml
I imported in AI project the HKLM registry branch from a workstation with a software product installed. For each profile i created a new Feature.
Also I created a checklist.
During installation, the user selects the desired profile from the checklist. In accordance with his choice, the required registry branch will be added to HKLM. But I didn't understand how to set the list of values ​​for the checklist and what condition to use for the Feature.
Last edited by aalyam on Thu May 13, 2021 5:28 pm, edited 1 time in total.

aalyam
Posts: 6
Joined: Sun Apr 25, 2021 10:56 pm

Re: Choose value in xml and put in registry

Thu May 13, 2021 11:45 am

I did it successfully.
1. is it possible to make the selection of the value from the combobox required?
2. how to pass multiple selected values ​​from checklist to combobox? I get one value with commas
Attachments
2.png
2.png (44.23 KiB) Viewed 4834 times

Catalin
Posts: 4324
Joined: Wed Jun 13, 2018 7:49 am

Re: Choose value in xml and put in registry

Tue May 18, 2021 1:20 pm

Hello,

Thank you for your followup on this!

I am glad you got this working.
1. is it possible to make the selection of the value from the combobox required?
To do so, you can select the "Next" button in the dialog containing the combobox control and set two "Control Events", as it follows:

Condition: COMBOBOX_1_PROP = ""
Action: Disable


Condition: NOT COMBOBOX_1_PROP = ""
Action: Enable


Where COMBOBOX_1_PROP is the property assigned to your combobox control.

This way, the "Next" button will be disabled until the user will select a value from the combobox.
2. how to pass multiple selected values ​​from checklist to combobox? I get one value with commas
Here, please note that in order to add multiple values to a combobox, you will need to use the "|" separator, e.g.:

Set Installer Property
Property: AI_COMBOBOX_DATA
Argument: COMBOBOX_1_PROP| Value1| Value2


This is also explained in the 3. Populate ComboBox and ListBox controls article.

By default, a checklist control (the one you are using) will save the values selected by the user at install time in a property, separated by a "," character.

Basically, let's consider a checklist control with the following elements in it:

Text: Element1
Value: Value1


Text: Element2
Value: Value2


If the user select both of these at install time, the property assigned to your checklist control will look as it follows:

Property: CHECKLIST_1_PROP
Value: Element1, Element2


If you populate the combobox using the CHECKLIST_1_PROP property's value, even though it contains more items, it will be added as a single element to the combobox, as in your screenshot.

Based on the article I have give above, if we want to insert multiple items into the combobox control, we will have to separate the items with the "|" character.

The easiest way to do so would be to set the "|" as the separator for the checklist control (the comma "," is the default separator):
NewSeparator.png
NewSeparator.png (121.35 KiB) Viewed 4759 times

This way, the items will be added separatly to the combobox control.

However, please note that a drawback exists for this method - that being if the user, for instance, forgets to add an element and has to go back to select it. If this is the case, the combobox will already contain some elements and the populate will fail due to two elements having the same value, e.g.:

If the user selects only Element1, this will be added. Now, if the user goes back and selects Element2 as well, the custom action will try to readd the Element1 element, resulting in an error because that element already exists.

This can be avoided by adding the "DeleteFromCombobox" custom action as a "Published Event" for the "Back" button.

More information about this in the "Delete items from ComboBox and ListBox controls" article.

Additionally, for your reference, please find attached a sample project in which I have showcased everything said above:
Sample Project Combobox.aip
(23.8 KiB) Downloaded 140 times

Hope this will help!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”