och
Posts: 9
Joined: Wed Jan 07, 2015 12:41 pm

Searched numeric registry raw value prepended with #

Hello,

I am trying to search for numeric value in registry and then use it in different registry key. The value is of type REG_DWORD. But the result is prepended with # character.

Example:
I search for

Code: Select all

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Common]
"LastAccessInstall"=dword:0000000e

Then save it to property OFFICE_VERSION.
Then update

Code: Select all

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\[OFFICE_VERSION].0\Outlook\SchedulingInformation\FreeBusySupport]
"SMTP"="{00000000-0000-0000-0000-000000000000}"
What I want is

Code: Select all

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\14.0\Outlook\SchedulingInformation\FreeBusySupport]
"SMTP"="{00000000-0000-0000-0000-000000000000}"

But I got

Code: Select all

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\#14.0\Outlook\SchedulingInformation\FreeBusySupport]
"SMTP"="{00000000-0000-0000-0000-000000000000}"
How can I get rid of that leading # character? I guess there is something going on with string vs numeric value but I cannot figure it out.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Searched numeric registry raw value prepended with #

Hi and welcome to Advanced Installer forums.

Thank you for your interest in Advanced Installer.

Indeed, this is the normal behavior when a "REG_DWORD" value is searched. In order to get rid of that character, you can create a simple custom action that parses the OFFICE_VERSION property and removes the first character from it.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
och
Posts: 9
Joined: Wed Jan 07, 2015 12:41 pm

Re: Searched numeric registry raw value prepended with #

Thank for reply,
but I'll need some more information.

I found Custom Action "Set Installer Property" which seems the most appropriate. But how do I do the actual character removal? All I found is http://www.advancedinstaller.com/user-g ... atted.html and http://www.advancedinstaller.com/user-g ... #section34 but that's very basic and doesn't answer my question.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Searched numeric registry raw value prepended with #

Hi,

The "Set installer property" custom action can be used to assign a value to a property. However, it cannot be used to edit the value of a property. To achieve this, you can add a "Execute inline script" custom action and write the following code:

Code: Select all

txt = Session.Property("OFFICE_VERSION")
Session.Property("OFFICE_VERSION") = replace(txt,"#","")
Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
och
Posts: 9
Joined: Wed Jan 07, 2015 12:41 pm

Re: Searched numeric registry raw value prepended with #

Yes! That's it, thanks very much!
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Searched numeric registry raw value prepended with #

You're welcome. Glad to help.

Just let us know anytime you have a question.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”