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

Auto numbering registry value if same already exists

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: 7030
Joined: Wed Jun 13, 2018 7:49 am

Re: Auto numbering registry value if same already exists

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

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.71 KiB) Viewed 16019 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.46 KiB) Viewed 16019 times


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

Re: Auto numbering registry value if same already exists

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”