finnegerd
Posts: 4
Joined: Mon Dec 04, 2023 8:52 pm

Auto numbering registry value if same already exists

Mon Dec 04, 2023 9:06 pm

Hi,

I try to create an installer for my Excel-Dna UDF. In the current situation, if I set my registry value as OPEN (I have to name it like this according to Microsoft registration rules) and if there is already a value having the same name (another OPEN), my registry file overwrites it.

How can I set the installer to dynamically rename my registry value as OPEN1 automatically if there is OPEN already. Is it possible? Plus, the installer should also remember this dynamically created name (OPEN1) to find it during the uninstallation process.

Thanks.

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

Re: Auto numbering registry value if same already exists

Wed Dec 06, 2023 11:19 am

Hello,

There are multiple ways of achieving what you need.

What I'm thinking is this:

- have a property with the "none" value defined in the "Properties" page

- in a script Custom Action (e.g. PowerShell), we can look for the registry you mentioned:

1. if the value exists, set the property to value OPEN1

2. if the value does not exist, set the property to value OPEN

Have this custom action scheduled after the "Searches" action group in the "Custom Actions" page.

Hope this helps!

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

finnegerd
Posts: 4
Joined: Mon Dec 04, 2023 8:52 pm

Re: Auto numbering registry value if same already exists

Thu Dec 07, 2023 8:40 am

Thank you for your prompt reply Catalin.

Using powershell script, I succeeded to determine whether there is already "OPEN" or not and set it to a property as you describe.

And placed this custom action after "Searches" action group as below.
install_execution_stage.jpg
install_execution_stage.jpg (9.71KiB)Viewed 9931 times


Then I assigned my custom property's value to the name of value in Registry page as in below. It worked !
registry value.jpg
registry value.jpg (119.46KiB)Viewed 9931 times


Regards,

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

Re: Auto numbering registry value if same already exists

Thu Dec 07, 2023 1:47 pm

Hello,

Thank you for your followup on this!

I am glad to hear everything worked. :)

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

Return to “Common Problems”